Skip to content

Commit

Permalink
add some more cases
Browse files Browse the repository at this point in the history
  • Loading branch information
carstenartur authored and jjohnstn committed Oct 17, 2024
1 parent 02e856d commit 460b131
Show file tree
Hide file tree
Showing 4 changed files with 166 additions and 167 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
package org.eclipse.jdt.junit.tests;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

import java.util.Iterator;
import java.util.List;
Expand Down Expand Up @@ -213,10 +213,9 @@ protected void waitForTableToFill(int numExpectedTableLines,
int millisecondTimeout, boolean lastItemHasImage) throws PartInitException {
long startTime = System.currentTimeMillis();
while (stillWaiting(numExpectedTableLines, lastItemHasImage)) {
if (System.currentTimeMillis() - startTime > millisecondTimeout)
fail("Timeout waiting for " + numExpectedTableLines
+ " lines in table. Present: " + getNumTableItems() + " items.\n"
+ "The 2nd vm has " + (hasNotTerminated() ? "not " : "") + "terminated.");
assertFalse("Timeout waiting for " + numExpectedTableLines
+ " lines in table. Present: " + getNumTableItems() + " items.\n"
+ "The 2nd vm has " + (hasNotTerminated() ? "not " : "") + "terminated.", System.currentTimeMillis() - startTime > millisecondTimeout);
dispatchEvents();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

Expand Down Expand Up @@ -297,7 +298,7 @@ public void testBug578547() {

filter= new TypeInfoFilter("Test", scope, 0, null);
assertEquals("Test", filter.getNamePattern());
assertEquals(null, filter.getPackagePattern());
assertNull(filter.getPackagePattern());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

import java.util.ArrayList;
import java.util.Hashtable;
Expand Down Expand Up @@ -145,7 +144,7 @@ public void testCreateClass1() throws Exception {
* File
*/
package test1;
/**
* Type
*/
Expand Down Expand Up @@ -187,9 +186,9 @@ public void testCreateClass2() throws Exception {
* File
*/
package test1;
import java.util.ArrayList;
/**
* Type
*/
Expand Down Expand Up @@ -241,14 +240,14 @@ public class A<T> {
* File
*/
package test1;
import pack.A;
/**
* Type
*/
public class E extends A<String> {
/**
* Overridden
*/
Expand Down Expand Up @@ -303,27 +302,27 @@ public class A<T> {
* File
*/
package test1;
import pack.A;
/**
* Type
*/
public class E extends A<String> {
/**
* Constructor
*/
public E(String t) {
super(t);
}
/* class body */
/**
* Method
*/
public static void main(String[] args) {
}
}
""";
Expand Down Expand Up @@ -370,17 +369,17 @@ public class A<T> {

String expected= """
package pack;
import java.util.ArrayList;
public class A<T> {
/**
* Type
*/
public class E<S> extends ArrayList<S> {
/* class body */
}
public abstract void foo(T t);
}
""";
Expand Down Expand Up @@ -423,11 +422,11 @@ public void testCreateClassExtraImports1() throws Exception {
* File
*/
package test1;
import java.io.File;
import java.util.List;
import java.util.Map;
/**
* Type
*/
Expand Down Expand Up @@ -486,16 +485,16 @@ public static class Inner {
* File
*/
package test1;
import java.util.Map;
import pack.A;
/**
* Type
*/
public class E extends A {
/**
* Overridden
*/
Expand Down Expand Up @@ -526,9 +525,9 @@ public static class Inner {
IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null);
String str1= """
package test1;
import java.util.Map;
public class B {
}
""";
Expand Down Expand Up @@ -558,18 +557,18 @@ public class B {

String expected= """
package test1;
import java.util.Map;
import pack.A;
public class B {
/**
* Type
*/
public class E extends A {
/**
* Overridden
*/
Expand Down Expand Up @@ -612,9 +611,9 @@ public void testCreateInterface() throws Exception {
* File
*/
package test1;
import java.util.List;
/**
* Type
*/
Expand Down Expand Up @@ -652,7 +651,7 @@ public void testCreateEnum() throws Exception {
* File
*/
package test1;
/**
* Type
*/
Expand Down Expand Up @@ -690,7 +689,7 @@ public void testCreateAnnotation() throws Exception {
* File
*/
package test1;
/**
* Type
*/
Expand Down Expand Up @@ -811,9 +810,9 @@ public void testAttemptCreateExistingClass() throws Exception
IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null);
String str= """
package test1;
public class Foo1 {
}
""";
ICompilationUnit cu= pack1.createCompilationUnit("Foo1.java", str, false, null);
Expand All @@ -823,9 +822,9 @@ public class Foo1 {
pack1= fSourceFolder.createPackageFragment("test2", false, null);
String str1= """
package test2;
public class Foo3 {
}
""";
pack1.createCompilationUnit("Foo3.java", str1, false, null);
Expand All @@ -849,7 +848,7 @@ public void testAddFinalSuperClassError1() throws Exception {
IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null);
String test= """
package test1;
public final class A{
}
""";
Expand All @@ -873,8 +872,8 @@ public final class A{

IStatus status= wizardPage.getSuperClassStatus();
assertNotNull(status);
assertTrue(status.getSeverity() == IStatus.ERROR);
assertTrue(expected.equals(status.getMessage()));
assertEquals(IStatus.ERROR, status.getSeverity());
assertEquals(expected, status.getMessage());
}

private static ITypeBinding getTypeBinding(ICompilationUnit cu) {
Expand Down
Loading

0 comments on commit 460b131

Please sign in to comment.