Bug 568264 - Clean up junit assertions
Change-Id: I54ec1246289767a4d18aeff43d04bec9a3a4e572
Signed-off-by: Carsten Hammer <carsten.hammer@t-online.de>
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/AbstractJDITest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/AbstractJDITest.java
index 545e821..1541822 100644
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/AbstractJDITest.java
+++ b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/AbstractJDITest.java
@@ -1062,9 +1062,9 @@
try {
getObjectReference().setValue(field, value);
} catch (ClassNotLoadedException e) {
- assertTrue("resetField.2", false);
+ fail("resetField.2");
} catch (InvalidTypeException e) {
- assertTrue("resetField.3", false);
+ fail("resetField.3");
}
}
/**
@@ -1077,9 +1077,9 @@
try {
getMainClass().setValue(field, value);
} catch (ClassNotLoadedException e) {
- assertTrue("resetField.1", false);
+ fail("resetField.1");
} catch (InvalidTypeException e) {
- assertTrue("resetField.2", false);
+ fail("resetField.2");
}
}
/**
@@ -1425,16 +1425,16 @@
// Set the "fEventType" field to the given eventType
ClassType type = getMainClass();
Field field = type.fieldByName("fEventType");
- assertTrue("1", field != null);
+ assertNotNull("1", field);
Value value = null;
value = fVM.mirrorOf(eventType);
try {
type.setValue(field, value);
} catch (ClassNotLoadedException e) {
- assertTrue("2", false);
+ fail("2");
} catch (InvalidTypeException e) {
- assertTrue("3", false);
+ fail("3");
}
// Resume the test thread
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/AccessibleTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/AccessibleTest.java
index 412c6fb..1728519 100644
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/AccessibleTest.java
+++ b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/AccessibleTest.java
@@ -63,18 +63,18 @@
* Test JDI isPackagePrivate().
*/
public void testJDIIsPackagePrivate() {
- assertTrue("1", !fArrayType.isPackagePrivate());
- assertTrue("2", !fClassType.isPackagePrivate());
- assertTrue("3", !fInterfaceType.isPackagePrivate());
- assertTrue("4", !fField.isPackagePrivate());
- assertTrue("5", !fMethod.isPackagePrivate());
+ assertFalse("1", fArrayType.isPackagePrivate());
+ assertFalse("2", fClassType.isPackagePrivate());
+ assertFalse("3", fInterfaceType.isPackagePrivate());
+ assertFalse("4", fField.isPackagePrivate());
+ assertFalse("5", fMethod.isPackagePrivate());
}
/**
* Test JDI isPrivate().
*/
public void testJDIIsPrivate() {
- assertTrue("1", !fField.isPrivate());
- assertTrue("2", !fMethod.isPrivate());
+ assertFalse("1", fField.isPrivate());
+ assertFalse("2", fMethod.isPrivate());
// NB: isPrivate() is undefined for a type
}
@@ -82,8 +82,8 @@
* Test JDI isProtected().
*/
public void testJDIIsProtected() {
- assertTrue("1", !fField.isProtected());
- assertTrue("2", !fMethod.isProtected());
+ assertFalse("1", fField.isProtected());
+ assertFalse("2", fMethod.isProtected());
// NB: isProtected() is undefined for a type
}
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ArrayReferenceTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ArrayReferenceTest.java
index 052093a..34b33e7 100644
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ArrayReferenceTest.java
+++ b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ArrayReferenceTest.java
@@ -86,9 +86,9 @@
try {
fDoubleArray.setValue(0, piValue);
} catch (ClassNotLoadedException e) {
- assertTrue("testJDIGetSetDoubleValue.3.1", false);
+ fail("testJDIGetSetDoubleValue.3.1");
} catch (InvalidTypeException e) {
- assertTrue("testJDIGetSetDoubleValue.3.2", false);
+ fail("testJDIGetSetDoubleValue.3.2");
}
DoubleValue value = (DoubleValue) fDoubleArray.getValue(0);
assertEquals("testJDIGetSetDoubleValue.4.1", value, piValue);
@@ -116,9 +116,9 @@
try {
fDoubleArray.setValues(newValues);
} catch (ClassNotLoadedException e) {
- assertTrue("testJDIGetSetDoubleValue.7.1", false);
+ fail("testJDIGetSetDoubleValue.7.1");
} catch (InvalidTypeException e) {
- assertTrue("testJDIGetSetDoubleValue.7.2", false);
+ fail("testJDIGetSetDoubleValue.7.2");
}
values = fDoubleArray.getValues();
assertEquals("testJDIGetSetDoubleValue.8", values, newValues);
@@ -145,9 +145,9 @@
try {
fDoubleArray.setValues(0, newValues, 0, 2);
} catch (ClassNotLoadedException e) {
- assertTrue("testJDIGetSetDoubleValue.11.1", false);
+ fail("testJDIGetSetDoubleValue.11.1");
} catch (InvalidTypeException e) {
- assertTrue("testJDIGetSetDoubleValue.11.2", false);
+ fail("testJDIGetSetDoubleValue.11.2");
}
values = fDoubleArray.getValues(0, 2);
assertEquals("testJDIGetSetDoubleValue.12", values, newValues);
@@ -168,9 +168,9 @@
try {
fArray.setValue(0, newValue);
} catch (ClassNotLoadedException e) {
- assertTrue("2.1", false);
+ fail("2.1");
} catch (InvalidTypeException e) {
- assertTrue("2.2", false);
+ fail("2.2");
}
StringReference value = (StringReference) fArray.getValue(0);
assertEquals("3", value, newValue);
@@ -198,9 +198,9 @@
try {
fArray.setValues(newValues);
} catch (ClassNotLoadedException e) {
- assertTrue("5.1", false);
+ fail("5.1");
} catch (InvalidTypeException e) {
- assertTrue("6.2", false);
+ fail("6.2");
}
values = fArray.getValues();
assertEquals("7", values, newValues);
@@ -228,9 +228,9 @@
try {
fArray.setValues(0, newValues, 0, 2);
} catch (ClassNotLoadedException e) {
- assertTrue("9.1", false);
+ fail("9.1");
} catch (InvalidTypeException e) {
- assertTrue("9.2", false);
+ fail("9.2");
}
values = fArray.getValues(0, 2);
assertEquals("10", values, newValues);
@@ -240,12 +240,12 @@
try {
fArray.setValues(0, newValues, 0, 2);
} catch (ClassNotLoadedException e) {
- assertTrue("11.1", false);
+ fail("11.1");
} catch (InvalidTypeException e) {
- assertTrue("11.2", false);
+ fail("11.2");
}
values = fArray.getValues(0, 2);
- assertEquals("12", values.get(0), null);
+ assertNull("12", values.get(0));
}
/**
* Test JDI length() and JDWP 'Array - Get length'.
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ArrayTypeTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ArrayTypeTest.java
index 7662d97..21219b5 100644
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ArrayTypeTest.java
+++ b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ArrayTypeTest.java
@@ -73,7 +73,7 @@
try {
type = fType.componentType();
} catch (ClassNotLoadedException e) {
- assertTrue("1", false);
+ fail("1");
}
assertEquals("2", expected, type);
}
@@ -89,9 +89,9 @@
*/
public void testJDINewInstance() {
ArrayReference instance = fType.newInstance(1);
- assertTrue("1", instance.type().equals(fType));
+ assertEquals("1", instance.type(), fType);
assertEquals("2", 1, instance.length());
- assertTrue("3", null == instance.getValue(0));
+ assertNull("3", instance.getValue(0));
ArrayReference instance2 = fType.newInstance(5);
try {
@@ -99,10 +99,7 @@
} catch (InvalidTypeException exc) {
} catch (ClassNotLoadedException exc) {
}
- assertTrue("4", instance2.getValue(2) == null);
- assertEquals(
- "5",
- ((StringReference) (instance2.getValue(3))).value(),
- "Yo");
+ assertNull("4", instance2.getValue(2));
+ assertEquals("5", "Yo", ((StringReference) (instance2.getValue(3))).value());
}
}
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/BooleanValueTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/BooleanValueTest.java
index 7b2cc63..0aff492 100644
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/BooleanValueTest.java
+++ b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/BooleanValueTest.java
@@ -14,6 +14,8 @@
package org.eclipse.debug.jdi.tests;
+import static org.junit.Assert.assertNotEquals;
+
import com.sun.jdi.BooleanValue;
/**
@@ -56,16 +58,16 @@
*/
public void testJDIEquality() {
assertTrue("1", fValue.equals(fVM.mirrorOf(true)));
- assertTrue("2", !fValue.equals(fVM.mirrorOf(false)));
- assertTrue("3", !fValue.equals(new Object()));
- assertTrue("4", !fValue.equals(null));
+ assertFalse("2", fValue.equals(fVM.mirrorOf(false)));
+ assertFalse("3", fValue.equals(new Object()));
+ assertFalse("4", fValue.equals(null));
assertEquals("5", fValue.hashCode(), fVM.mirrorOf(true).hashCode());
- assertTrue("6", fValue.hashCode() != fVM.mirrorOf(false).hashCode());
+ assertNotEquals("6", fValue.hashCode(), fVM.mirrorOf(false).hashCode());
}
/**
* Test JDI value().
*/
public void testJDIValue() {
- assertTrue("1", true == fValue.value());
+ assertTrue("1", fValue.value());
}
}
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ByteValueTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ByteValueTest.java
index 4dbf3e0..e0ceace 100644
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ByteValueTest.java
+++ b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ByteValueTest.java
@@ -14,6 +14,8 @@
package org.eclipse.debug.jdi.tests;
+import static org.junit.Assert.assertNotEquals;
+
import com.sun.jdi.ByteValue;
/**
@@ -56,16 +58,16 @@
*/
public void testJDIEquality() {
assertTrue("1", fValue.equals(fVM.mirrorOf((byte) 1)));
- assertTrue("2", !fValue.equals(fVM.mirrorOf((byte) 2)));
- assertTrue("3", !fValue.equals(new Object()));
- assertTrue("4", !fValue.equals(null));
+ assertFalse("2", fValue.equals(fVM.mirrorOf((byte) 2)));
+ assertFalse("3", fValue.equals(new Object()));
+ assertFalse("4", fValue.equals(null));
assertEquals("5", fValue.hashCode(), fVM.mirrorOf((byte) 1).hashCode());
- assertTrue("6", fValue.hashCode() != fVM.mirrorOf((byte) 2).hashCode());
+ assertNotEquals("6", fValue.hashCode(), fVM.mirrorOf((byte) 2).hashCode());
}
/**
* Test JDI value().
*/
public void testJDIValue() {
- assertTrue("1", 1 == fValue.value());
+ assertEquals("1", 1, fValue.value());
}
}
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/CharValueTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/CharValueTest.java
index 76a7615..d8662e7 100644
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/CharValueTest.java
+++ b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/CharValueTest.java
@@ -14,6 +14,8 @@
package org.eclipse.debug.jdi.tests;
+import static org.junit.Assert.assertNotEquals;
+
import com.sun.jdi.CharValue;
/**
@@ -56,16 +58,16 @@
*/
public void testJDIEquality() {
assertTrue("1", fValue.equals(fVM.mirrorOf('a')));
- assertTrue("2", !fValue.equals(fVM.mirrorOf('b')));
- assertTrue("3", !fValue.equals(new Object()));
- assertTrue("4", !fValue.equals(null));
+ assertFalse("2", fValue.equals(fVM.mirrorOf('b')));
+ assertFalse("3", fValue.equals(new Object()));
+ assertFalse("4", fValue.equals(null));
assertEquals("5", fValue.hashCode(), fVM.mirrorOf('a').hashCode());
- assertTrue("6", fValue.hashCode() != fVM.mirrorOf('b').hashCode());
+ assertNotEquals("6", fValue.hashCode(), fVM.mirrorOf('b').hashCode());
}
/**
* Test JDI value().
*/
public void testJDIValue() {
- assertTrue("1", 'a' == fValue.value());
+ assertEquals("1", 'a', fValue.value());
}
}
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ClassPrepareRequestTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ClassPrepareRequestTest.java
index 82fdc31..4f69ad9 100644
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ClassPrepareRequestTest.java
+++ b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ClassPrepareRequestTest.java
@@ -64,7 +64,7 @@
"ClassPrepareEvent1",
true,
5000);
- assertTrue("1", event != null);
+ assertNotNull("1", event);
assertEquals(
"2",
"org.eclipse.debug.jdi.tests.program.TestClass1",
@@ -79,7 +79,7 @@
"ClassPrepareEvent2",
true,
5000);
- assertTrue("3", event == null);
+ assertNull("3", event);
requestManager.deleteEventRequest(request);
// Filter is "*.TestClass3" and loads org.eclipse.debug.jdi.tests.program.TestClass3
@@ -90,7 +90,7 @@
"ClassPrepareEvent3",
true,
5000);
- assertTrue("4", event != null);
+ assertNotNull("4", event);
assertEquals(
"5",
"org.eclipse.debug.jdi.tests.program.TestClass3",
@@ -105,7 +105,7 @@
"ClassPrepareEvent4",
true,
5000);
- assertTrue("6", event == null);
+ assertNull("6", event);
requestManager.deleteEventRequest(request);
// Filter is "*.eclipse.debug.jdi.tests.program.*" and loads org.eclipse.debug.jdi.tests.program.TestClass5
@@ -116,7 +116,7 @@
"ClassPrepareEvent5",
true,
5000);
- assertTrue("7", event == null);
+ assertNull("7", event);
requestManager.deleteEventRequest(request);
// Filter is "org.eclipse.debug.jdi.tests.program.TestClass6" and loads org.eclipse.debug.jdi.tests.program.TestClass6
@@ -128,7 +128,7 @@
"ClassPrepareEvent6",
true,
5000);
- assertTrue("8", event != null);
+ assertNotNull("8", event);
assertEquals(
"9",
"org.eclipse.debug.jdi.tests.program.TestClass6",
@@ -151,7 +151,7 @@
"ClassPrepareEvent7",
true,
5000);
- assertTrue("1", event != null);
+ assertNotNull("1", event);
assertEquals(
"2",
"org.eclipse.debug.jdi.tests.program.TestClazz8",
@@ -167,7 +167,7 @@
"ClassPrepareEvent8",
true,
5000);
- assertTrue("3", event != null);
+ assertNotNull("3", event);
assertEquals(
"4",
"org.eclipse.debug.jdi.tests.program.TestClazz10",
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ClassTypeTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ClassTypeTest.java
index 7e62935..51fd5ee 100644
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ClassTypeTest.java
+++ b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ClassTypeTest.java
@@ -94,8 +94,9 @@
while (interfaces.hasNext()) {
InterfaceType next = (InterfaceType) interfaces.next();
assertTrue(next.name(), all.contains(next));
- if (next.name().equals("java.lang.Comparable"))
+ if (next.name().equals("java.lang.Comparable")) {
found = true;
+ }
}
assertTrue("1", found);
}
@@ -118,9 +119,9 @@
*/
public void testJDIConcreteMethodByName() {
Method method = fType.concreteMethodByName("run", "()V");
- assertTrue("1", method != null);
+ assertNotNull("1", method);
assertEquals("2", fType, method.declaringType());
- assertTrue("3", fType.concreteMethodByName("xxx", "(I)Z") == null);
+ assertNull("3", fType.concreteMethodByName("xxx", "(I)Z"));
}
/**
* Test JDI interfaces().
@@ -136,13 +137,15 @@
Object next = iterator.next();
assertTrue("2." + i++, next instanceof InterfaceType);
InterfaceType ift = (InterfaceType) next;
- if (ift.name().equals("java.lang.Runnable"))
+ if (ift.name().equals("java.lang.Runnable")) {
found = true;
- if (ift.name().equals("java.lang.Comparable"))
+ }
+ if (ift.name().equals("java.lang.Comparable")) {
extra = true;
+ }
}
assertTrue("1", found);
- assertTrue("2", !extra);
+ assertFalse("2", extra);
}
/**
* Test JDI invokeMethod(ThreadReference, Method, Value[]).
@@ -174,8 +177,8 @@
} catch (Exception exc) {
oops = exc;
}
- assertTrue("1", oops == null);
- assertEquals("2", val == null ? null : ((StringReference) val).value(), "41");
+ assertNull("1", oops);
+ assertEquals("2", "41", val == null ? null : ((StringReference) val).value());
}
/**
* Test JDI invokeMethod - failure.
@@ -203,8 +206,8 @@
} catch (Exception exc) {
oops = exc;
}
- assertTrue("1", oops == null);
- assertTrue("2", good != null);
+ assertNull("1", oops);
+ assertNotNull("2", good);
}
/**
* Test JDI locationsOfLine(int).
@@ -215,7 +218,7 @@
try {
locations = fType.locationsOfLine(lineNumber);
} catch (AbsentInformationException e) {
- assertTrue("1", false);
+ fail("1");
}
assertEquals("2", 1, locations.size());
}
@@ -223,13 +226,13 @@
* Test JDI methodByName
*/
public void testJDIMethodByName() {
- assertTrue("1", fType.methodsByName("main").size() == 1);
+ assertEquals("1", 1, fType.methodsByName("main").size());
}
/**
* Test JDI methodByNameAndSignature
*/
public void testJDIMethodByNameAndSignature() {
- assertTrue("1", fType.methodsByName("printAndSignal", "()V").size() == 1);
+ assertEquals("1", 1, fType.methodsByName("printAndSignal", "()V").size());
}
/**
* Test JDI methods().
@@ -239,8 +242,9 @@
Iterator<?> it = fType.methods().iterator();
while (it.hasNext()) {
Method mth = (Method) it.next();
- if (mth.name().equals("printAndSignal"))
+ if (mth.name().equals("printAndSignal")) {
found = true;
+ }
}
assertTrue("1", found);
}
@@ -273,15 +277,15 @@
try {
result = fType.newInstance(thread, constructor, arguments, 0);
} catch (IncompatibleThreadStateException e) {
- assertTrue("1", false);
+ fail("1");
} catch (InvalidTypeException e) {
- assertTrue("2", false);
+ fail("2");
} catch (ClassNotLoadedException e) {
- assertTrue("3", false);
+ fail("3");
} catch (InvocationException e) {
- assertTrue("4", false);
+ fail("4");
}
- assertTrue("5", result != null);
+ assertNotNull("5", result);
assertTrue("6", result.referenceType().equals(fType));
waitUntilReady();
}
@@ -292,7 +296,7 @@
// Get static field "fInt"
Field field = fType.fieldByName("fInt");
- assertTrue("1", field != null);
+ assertNotNull("1", field);
assertTrue("2", field.isStatic());
// Remember old value
@@ -303,9 +307,9 @@
try {
fType.setValue(field, newValue);
} catch (ClassNotLoadedException e) {
- assertTrue("3.1", false);
+ fail("3.1");
} catch (InvalidTypeException e) {
- assertTrue("3.2", false);
+ fail("3.2");
}
// Ensure the value as been set
@@ -315,14 +319,14 @@
try {
fType.setValue(field, oldValue);
} catch (ClassNotLoadedException e) {
- assertTrue("5.1", false);
+ fail("5.1");
} catch (InvalidTypeException e) {
- assertTrue("5.2", false);
+ fail("5.2");
}
// Get static field "fString" to test if it can be set to null.
field = fType.fieldByName("fString");
- assertTrue("6", field != null);
+ assertNotNull("6", field);
assertTrue("7", field.isStatic());
// Remember old value
@@ -333,9 +337,9 @@
try {
fType.setValue(field, newValue);
} catch (ClassNotLoadedException e) {
- assertTrue("8.1", false);
+ fail("8.1");
} catch (InvalidTypeException e) {
- assertTrue("8.2", false);
+ fail("8.2");
}
// Ensure the value as been set
@@ -345,9 +349,9 @@
try {
fType.setValue(field, oldValue);
} catch (ClassNotLoadedException e) {
- assertTrue("10.1", false);
+ fail("10.1");
} catch (InvalidTypeException e) {
- assertTrue("10.2", false);
+ fail("10.2");
}
}
/**
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ConstantPoolTests.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ConstantPoolTests.java
index 644e499..f2f83d1 100644
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ConstantPoolTests.java
+++ b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ConstantPoolTests.java
@@ -13,6 +13,8 @@
*******************************************************************************/
package org.eclipse.debug.jdi.tests;
+import static org.junit.Assert.assertNotEquals;
+
import com.sun.jdi.ArrayType;
import com.sun.jdi.ReferenceType;
@@ -39,7 +41,7 @@
assertTrue("Should have classfile version info", fVM.canGetClassFileVersion());
}
else {
- assertTrue("Should not have classfile version info", !fVM.canGetClassFileVersion());
+ assertFalse("Should not have classfile version info", fVM.canGetClassFileVersion());
}
}
@@ -69,13 +71,13 @@
fClass.majorVersion();
}
catch(UnsupportedOperationException uoe) {
- assertTrue("Threw unsupported exception in 1.6 VM", false);
+ fail("Threw unsupported exception in 1.6 VM");
}
}
else {
try {
fClass.majorVersion();
- assertTrue("No exception for non 1.6 VM", false);
+ fail("No exception for non 1.6 VM");
}
catch(UnsupportedOperationException uoe) {}
}
@@ -92,7 +94,7 @@
ArrayType type = getArrayType();
assertNotNull("type should not be null", type);
int ver = type.majorVersion();
- assertTrue("major verison should be 0", ver == 0);
+ assertEquals("major verison should be 0", 0, ver);
}
/**
@@ -107,7 +109,7 @@
fClass = getClass("org.eclipse.debug.jdi.tests.program.RefClass1");
assertNotNull("RefClass1 should not be null", fClass);
int ver = fClass.majorVersion();
- assertTrue("version cannot be equal to -1", ver != -1);
+ assertNotEquals("version cannot be equal to -1", -1, ver);
}
/**
@@ -123,13 +125,13 @@
fClass.minorVersion();
}
catch(UnsupportedOperationException uoe) {
- assertTrue("Threw unsupported exception in 1.6 VM", false);
+ fail("Threw unsupported exception in 1.6 VM");
}
}
else {
try {
fClass.minorVersion();
- assertTrue("No exception for non 1.6 VM", false);
+ fail("No exception for non 1.6 VM");
}
catch(UnsupportedOperationException uoe) {}
}
@@ -147,7 +149,7 @@
fClass = getClass("org.eclipse.debug.jdi.tests.program.RefClass1");
assertNotNull("RefClass1 should not be null", fClass);
int ver = fClass.minorVersion();
- assertTrue("version cannot be equal to -1", ver != -1);
+ assertNotEquals("version cannot be equal to -1", -1, ver);
}
/**
@@ -163,13 +165,13 @@
fClass.constantPoolCount();
}
catch(UnsupportedOperationException uoe) {
- assertTrue("Threw unsupported exception in 1.6 VM", false);
+ fail("Threw unsupported exception in 1.6 VM");
}
}
else {
try {
fClass.constantPoolCount();
- assertTrue("No exception for non 1.6 VM", false);
+ fail("No exception for non 1.6 VM");
}
catch(UnsupportedOperationException uoe) {}
}
@@ -204,13 +206,13 @@
fClass.constantPool();
}
catch(UnsupportedOperationException uoe) {
- assertTrue("Threw unsupported exception in 1.6 VM", false);
+ fail("Threw unsupported exception in 1.6 VM");
}
}
else {
try {
fClass.constantPool();
- assertTrue("No exception for non 1.6 VM", false);
+ fail("No exception for non 1.6 VM");
}
catch(UnsupportedOperationException uoe) {}
}
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ContendedMonitorTests.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ContendedMonitorTests.java
index 3138e44..9c19636 100644
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ContendedMonitorTests.java
+++ b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ContendedMonitorTests.java
@@ -46,7 +46,7 @@
assertTrue("Should have ability to request monitor events info", fVM.canRequestMonitorEvents());
}
else {
- assertTrue("Should not have ability to request monitor events info", !fVM.canRequestMonitorEvents());
+ assertFalse("Should not have ability to request monitor events info", fVM.canRequestMonitorEvents());
}
}
@@ -62,7 +62,7 @@
req.enable();
List<?> list = erm.monitorContendedEnterRequests();
assertNotNull("list should not be null", list);
- assertTrue("list should be of size 1", list.size() == 1);
+ assertEquals("list should be of size 1", 1, list.size());
assertTrue("req should be enabled", ((MonitorContendedEnterRequest)list.get(0)).isEnabled());
}
@@ -78,7 +78,7 @@
req.enable();
List<?> list = erm.monitorContendedEnteredRequests();
assertNotNull("list should not be null", list);
- assertTrue("list should be of size 1", list.size() == 1);
+ assertEquals("list should be of size 1", 1, list.size());
assertTrue("req should be enabled", ((MonitorContendedEnteredRequest)list.get(0)).isEnabled());
}
@@ -94,7 +94,7 @@
req.enable();
List<?> list = erm.monitorWaitRequests();
assertNotNull("list should not be null", list);
- assertTrue("list should be of size 1", list.size() == 1);
+ assertEquals("list should be of size 1", 1, list.size());
assertTrue("req should be enabled", ((MonitorWaitRequest)list.get(0)).isEnabled());
}
@@ -110,7 +110,7 @@
req.enable();
List<?> list = erm.monitorWaitedRequests();
assertNotNull("list should not be null", list);
- assertTrue("list should be of size 1", list.size() == 1);
+ assertEquals("list should be of size 1", 1, list.size());
assertTrue("req should be enabled", ((MonitorWaitedRequest)list.get(0)).isEnabled());
}
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/DoubleValueTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/DoubleValueTest.java
index 0f8006d..248e214 100644
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/DoubleValueTest.java
+++ b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/DoubleValueTest.java
@@ -14,6 +14,8 @@
package org.eclipse.debug.jdi.tests;
+import static org.junit.Assert.assertNotEquals;
+
import com.sun.jdi.DoubleValue;
/**
@@ -56,19 +58,19 @@
*/
public void testJDIEquality() {
assertTrue("1", fValue.equals(fVM.mirrorOf(12345.6789)));
- assertTrue("2", !fValue.equals(fVM.mirrorOf(98765.4321)));
- assertTrue("3", !fValue.equals(new Object()));
- assertTrue("4", !fValue.equals(null));
+ assertFalse("2", fValue.equals(fVM.mirrorOf(98765.4321)));
+ assertFalse("3", fValue.equals(new Object()));
+ assertFalse("4", fValue.equals(null));
assertEquals(
"5",
fValue.hashCode(),
fVM.mirrorOf(12345.6789).hashCode());
- assertTrue("6", fValue.hashCode() != fVM.mirrorOf(98765.4321).hashCode());
+ assertNotEquals("6", fValue.hashCode(), fVM.mirrorOf(98765.4321).hashCode());
}
/**
* Test JDI value().
*/
public void testJDIValue() {
- assertTrue("1", 12345.6789 == fValue.value());
+ assertEquals("1", 12345.6789, fValue.value(), .0);
}
}
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/EventRequestTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/EventRequestTest.java
index 55580e2..f7f87a9 100644
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/EventRequestTest.java
+++ b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/EventRequestTest.java
@@ -38,14 +38,16 @@
@Override
public void localSetUp() {
// Get all kinds of request
- if (fVM.canWatchFieldAccess())
+ if (fVM.canWatchFieldAccess()) {
fRequests.add(getAccessWatchpointRequest());
+ }
fRequests.add(getBreakpointRequest());
fRequests.add(fVM.eventRequestManager().createClassPrepareRequest());
fRequests.add(fVM.eventRequestManager().createClassUnloadRequest());
fRequests.add(getExceptionRequest());
- if (fVM.canWatchFieldModification())
+ if (fVM.canWatchFieldModification()) {
fRequests.add(getModificationWatchpointRequest());
+ }
fRequests.add(
fVM.eventRequestManager().createStepRequest(
getThread(),
@@ -83,15 +85,15 @@
public void testJDIEnable() {
for (int i = 0; i < fRequests.size(); i++) {
EventRequest request = fRequests.get(i);
- assertTrue("1." + i, !request.isEnabled());
+ assertFalse("1." + i, request.isEnabled());
request.setEnabled(true);
assertTrue("2." + i, request.isEnabled());
request.setEnabled(false);
- assertTrue("3." + i, !request.isEnabled());
+ assertFalse("3." + i, request.isEnabled());
request.enable();
assertTrue("4." + i, request.isEnabled());
request.disable();
- assertTrue("5." + i, !request.isEnabled());
+ assertFalse("5." + i, request.isEnabled());
}
}
/**
@@ -105,7 +107,7 @@
}
for (int i = 0; i < fRequests.size(); i++) {
EventRequest request = fRequests.get(i);
- assertTrue(String.valueOf(i), request.suspendPolicy() == policy);
+ assertEquals(String.valueOf(i), request.suspendPolicy(), policy);
}
}
/**
@@ -115,28 +117,28 @@
EventRequest request = fRequests.get(0);
request.putProperty(Integer.valueOf(0), "prop1");
String prop = (String) request.getProperty(Integer.valueOf(0));
- assertTrue("1", prop.equals("prop1"));
+ assertEquals("1", "prop1", prop);
request.putProperty(Integer.valueOf(0), null);
prop = (String) request.getProperty(Integer.valueOf(0));
- assertTrue("2", prop == null);
+ assertNull("2", prop);
request.putProperty(Integer.valueOf(0), "prop2");
request.putProperty(Integer.valueOf(0), "prop3");
prop = (String) request.getProperty(Integer.valueOf(0));
- assertTrue("3", prop.equals("prop3"));
+ assertEquals("3", "prop3", prop);
request.putProperty(Integer.valueOf(0), null);
prop = (String) request.getProperty(Integer.valueOf(0));
- assertTrue("4", prop == null);
+ assertNull("4", prop);
request.putProperty(Integer.valueOf(1), null);
prop = (String) request.getProperty(Integer.valueOf(1));
- assertTrue("5", prop == null);
+ assertNull("5", prop);
request.putProperty(Integer.valueOf(1), "prop1");
prop = (String) request.getProperty(Integer.valueOf(1));
- assertTrue("6", prop.equals("prop1"));
+ assertEquals("6", "prop1", prop);
}
}
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ExceptionEventTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ExceptionEventTest.java
index 16cf39f..b3fbb24 100644
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ExceptionEventTest.java
+++ b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ExceptionEventTest.java
@@ -71,7 +71,7 @@
*/
public void testJDICatchLocation() {
// Uncaught exception
- assertTrue("1", fEvent.catchLocation() == null);
+ assertNull("1", fEvent.catchLocation());
// TO DO: Caught exception
}
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ExceptionRequestTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ExceptionRequestTest.java
index b28fc60..bfdbe9c 100644
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ExceptionRequestTest.java
+++ b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ExceptionRequestTest.java
@@ -63,6 +63,6 @@
* Test JDI exception().
*/
public void testJDIException() {
- assertTrue("1", fRequest.exception() == null);
+ assertNull("1", fRequest.exception());
}
}
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/FieldTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/FieldTest.java
index 7067c2c..e1da9ea 100644
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/FieldTest.java
+++ b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/FieldTest.java
@@ -58,21 +58,21 @@
public void testJDIEquality() {
assertTrue("1", fField.equals(fField));
Field other = getField("fString");
- assertTrue("2", !fField.equals(other));
- assertTrue("3", !fField.equals(new Object()));
- assertTrue("4", !fField.equals(null));
+ assertFalse("2", fField.equals(other));
+ assertFalse("3", fField.equals(new Object()));
+ assertFalse("4", fField.equals(null));
}
/**
* Test JDI isTransient().
*/
public void testJDIIsTransient() {
- assertTrue("1", !fField.isTransient());
+ assertFalse("1", fField.isTransient());
}
/**
* Test JDI isVolatile().
*/
public void testJDIIsVolatile() {
- assertTrue("1", !fField.isVolatile());
+ assertFalse("1", fField.isVolatile());
}
/**
* Test JDI type().
@@ -81,7 +81,7 @@
try {
assertEquals("1", getMainClass(), fField.type());
} catch (ClassNotLoadedException e) {
- assertTrue("2", false);
+ fail("2");
}
}
/**
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/FloatValueTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/FloatValueTest.java
index e0a769c..1e40fd9 100644
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/FloatValueTest.java
+++ b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/FloatValueTest.java
@@ -14,6 +14,8 @@
package org.eclipse.debug.jdi.tests;
+import static org.junit.Assert.assertNotEquals;
+
import com.sun.jdi.FloatValue;
/**
@@ -56,16 +58,16 @@
*/
public void testJDIEquality() {
assertTrue("1", fValue.equals(fVM.mirrorOf(123.45f)));
- assertTrue("2", !fValue.equals(fVM.mirrorOf(54.321f)));
- assertTrue("3", !fValue.equals(new Object()));
- assertTrue("4", !fValue.equals(null));
+ assertFalse("2", fValue.equals(fVM.mirrorOf(54.321f)));
+ assertFalse("3", fValue.equals(new Object()));
+ assertFalse("4", fValue.equals(null));
assertEquals("5", fValue.hashCode(), fVM.mirrorOf(123.45f).hashCode());
- assertTrue("6", fValue.hashCode() != fVM.mirrorOf(54.321f).hashCode());
+ assertNotEquals("6", fValue.hashCode(), fVM.mirrorOf(54.321f).hashCode());
}
/**
* Test JDI value().
*/
public void testJDIValue() {
- assertTrue("1", 123.45f == fValue.value());
+ assertEquals("1", 123.45f, fValue.value(), .0F);
}
}
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ForceEarlyReturnTests.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ForceEarlyReturnTests.java
index 65f485e..0e4deaa 100644
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ForceEarlyReturnTests.java
+++ b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ForceEarlyReturnTests.java
@@ -86,7 +86,7 @@
assertTrue("value should be a StringReference", val instanceof StringReference);
fEventReader.removeEventListener(waiter);
//TODO make sure this works with the newest versions of the 1.6VM
- assertTrue("values should be 'foobar'", ((StringReference)val).value().equals("foobar"));
+ assertEquals("values should be 'foobar'", "foobar", ((StringReference) val).value());
}
}
} catch (IncompatibleThreadStateException e) {
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/HeapWalkingTests.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/HeapWalkingTests.java
index e87936c..181943a 100644
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/HeapWalkingTests.java
+++ b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/HeapWalkingTests.java
@@ -50,7 +50,7 @@
assertTrue("Should have instance info", fVM.canGetInstanceInfo());
}
else {
- assertTrue("Should not have instance info", !fVM.canGetInstanceInfo());
+ assertFalse("Should not have instance info", fVM.canGetInstanceInfo());
}
}
@@ -64,7 +64,7 @@
}
try {
fVM.instanceCounts(null);
- assertTrue("No excpetion thrown", false);
+ fail("No excpetion thrown");
}
catch (NullPointerException npe) {}
}
@@ -78,13 +78,13 @@
fVM.instanceCounts(new ArrayList<ReferenceType>());
}
catch(UnsupportedOperationException uoe) {
- assertTrue("Threw unsupported exception in 1.6 VM", false);
+ fail("Threw unsupported exception in 1.6 VM");
}
}
else {
try {
fVM.instanceCounts(new ArrayList<ReferenceType>());
- assertTrue("No exception for non 1.6 VM", false);
+ fail("No exception for non 1.6 VM");
}
catch(UnsupportedOperationException uoe) {}
}
@@ -108,9 +108,9 @@
list.add(fClass1);
long[] counts = fVM.instanceCounts(list);
assertNotNull("counts should not be null", counts);
- assertTrue("counts should have two entires", counts.length == 2);
- assertTrue("count for RefClass1 should be 2", counts[0] == 2);
- assertTrue("count for RefClass2 should be 1", counts[1] == 1);
+ assertEquals("counts should have two entires", 2, counts.length);
+ assertEquals("count for RefClass1 should be 2", 2, counts[0]);
+ assertEquals("count for RefClass2 should be 1", 1, counts[1]);
}
/**
@@ -124,13 +124,13 @@
fClass.instances(20);
}
catch(UnsupportedOperationException uoe) {
- assertTrue("Threw unsupported exception in 1.6 VM", false);
+ fail("Threw unsupported exception in 1.6 VM");
}
}
else {
try {
fClass.instances(20);
- assertTrue("No exception for non 1.6 VM", false);
+ fail("No exception for non 1.6 VM");
}
catch(UnsupportedOperationException uoe) {}
}
@@ -148,7 +148,7 @@
assertNotNull("classs should not be null", fClass);
try {
fClass.instances(-1);
- assertTrue("No excpetion thrown", false);
+ fail("No excpetion thrown");
}
catch (IllegalArgumentException iae) {}
}
@@ -169,7 +169,7 @@
assertNotNull("RefClass1 should not be null", fClass1);
List<?> list = fClass1.instances(10);
assertNotNull("list should not be null", list);
- assertTrue("list should have two enrtries", list.size() == 2);
+ assertEquals("list should have two enrtries", 2, list.size());
}
/**
@@ -185,13 +185,13 @@
fObject.referringObjects(100);
}
catch(UnsupportedOperationException uoe) {
- assertTrue("Threw unsupported exception in 1.6 VM", false);
+ fail("Threw unsupported exception in 1.6 VM");
}
}
else {
try {
fObject.referringObjects(10);
- assertTrue("No exception for non 1.6 VM", false);
+ fail("No exception for non 1.6 VM");
}
catch(UnsupportedOperationException uoe) {}
}
@@ -210,10 +210,9 @@
assertNotNull("String obj ref should not be null", fObject);
try {
fObject.referringObjects(-1);
- assertTrue("No excpetion thrown", false);
+ fail("No excpetion thrown");
}
catch (IllegalArgumentException iae) {
- assertTrue("Threw exception", true);
}
}
@@ -234,7 +233,7 @@
assertNotNull("String obj ref should not be null", fObject);
List<?> list = fObject.referringObjects(100);
assertNotNull("referring objects list should not be null", list);
- assertTrue("list size should be 4", list.size() == 4);
+ assertEquals("list size should be 4", 4, list.size());
assertTrue("list should contain the main class", list.contains(fClass.classObject()));
assertTrue("list should contain the main class thread", list.contains(getThread()));
}
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/HotCodeReplacementTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/HotCodeReplacementTest.java
index 4b914a9..19a30b1 100644
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/HotCodeReplacementTest.java
+++ b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/HotCodeReplacementTest.java
@@ -46,7 +46,7 @@
try {
stackSize = thread.frames().size();
} catch (IncompatibleThreadStateException e) {
- assertTrue("dropTopFrame.1", false);
+ fail("dropTopFrame.1");
}
// Create and install step out request
@@ -64,11 +64,11 @@
// Do return
boolean finallyBlocksSkipped = hcrThread.doReturn(null, true);
- assertTrue("dropTopFrame.2", !finallyBlocksSkipped);
+ assertFalse("dropTopFrame.2", finallyBlocksSkipped);
// Wait for the event to come in
Event event = waitForEvent(waiter, 10000); // Wait 10s max
- assertTrue("dropTopFrame.3", event != null);
+ assertNotNull("dropTopFrame.3", event);
fEventReader.removeEventListener(waiter);
fVM.eventRequestManager().deleteEventRequest(request);
@@ -78,7 +78,7 @@
try {
newStackSize = thread.frames().size();
} catch (IncompatibleThreadStateException e) {
- assertTrue("dropTopFrame.5", false);
+ fail("dropTopFrame.5");
}
assertEquals("dropTopFrame.6", stackSize - 1, newStackSize);
}
@@ -112,7 +112,7 @@
StackFrame frame = thread.frames(0, 1).get(0);
location = frame.location();
} catch (IncompatibleThreadStateException e) {
- assertTrue("reenterOnExit.1", false);
+ fail("reenterOnExit.1");
}
// Create and install reenter step request
@@ -132,7 +132,7 @@
// Wait for the step event to come in
StepEvent event = (StepEvent) waitForEvent(waiter, 10000); // Wait 10s max
- assertTrue("reenterOnExit.2", event != null);
+ assertNotNull("reenterOnExit.2", event);
fEventReader.removeEventListener(waiter);
fVM.eventRequestManager().deleteEventRequest(request);
@@ -142,9 +142,9 @@
StackFrame frame = thread.frames(0, 1).get(0);
newLocation = frame.location();
} catch (IncompatibleThreadStateException e) {
- assertTrue("reenterOnExit.3", false);
+ fail("reenterOnExit.3");
}
- assertTrue("reenterOnExit.4", !newLocation.equals(location));
+ assertFalse("reenterOnExit.4", newLocation.equals(location));
assertTrue("reenterOnExit.5", newLocation.codeIndex() <= location.codeIndex());
}
@@ -182,7 +182,7 @@
ClassUnloadEvent unloadEvent =
(ClassUnloadEvent) waitForEvent(unloadEventWaiter, 10000);
// Wait 10s max
- assertTrue("reloadClasses.2", unloadEvent != null);
+ assertNotNull("reloadClasses.2", unloadEvent);
fEventReader.removeEventListener(unloadEventWaiter);
fVM.eventRequestManager().deleteEventRequest(unloadRequest);
assertEquals(
@@ -194,7 +194,7 @@
ClassPrepareEvent loadEvent =
(ClassPrepareEvent) waitForEvent(loadEventWaiter, 10000);
// Wait 10s max
- assertTrue("reloadClasses.4", loadEvent != null);
+ assertNotNull("reloadClasses.4", loadEvent);
fEventReader.removeEventListener(loadEventWaiter);
fVM.eventRequestManager().deleteEventRequest(loadRequest);
ReferenceType newType = loadEvent.referenceType();
@@ -202,7 +202,7 @@
"reloadClasses.5",
"org.eclipse.debug.jdi.tests.program.MainClass",
newType.name());
- assertTrue("reloadClasses.6", !oldType.equals(newType));
+ assertFalse("reloadClasses.6", oldType.equals(newType));
}
/**
* Use case 1:
@@ -238,12 +238,14 @@
}
// Reload classes
- if (vm.canReloadClasses())
+ if (vm.canReloadClasses()) {
reloadClasses();
+ }
// Reenter on exit
- if (vm.canReenterOnExit())
+ if (vm.canReenterOnExit()) {
reenterOnExit(thread);
+ }
}
/**
* Make sure the test leaves the VM in the same state it found it.
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/IntegerValueTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/IntegerValueTest.java
index ca455a0..214f3dc 100644
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/IntegerValueTest.java
+++ b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/IntegerValueTest.java
@@ -14,6 +14,8 @@
package org.eclipse.debug.jdi.tests;
+import static org.junit.Assert.assertNotEquals;
+
import com.sun.jdi.IntegerValue;
/**
@@ -56,16 +58,16 @@
*/
public void testJDIEquality() {
assertTrue("1", fValue.equals(fVM.mirrorOf(12345)));
- assertTrue("2", !fValue.equals(fVM.mirrorOf(54321)));
- assertTrue("3", !fValue.equals(new Object()));
- assertTrue("4", !fValue.equals(null));
+ assertFalse("2", fValue.equals(fVM.mirrorOf(54321)));
+ assertFalse("3", fValue.equals(new Object()));
+ assertFalse("4", fValue.equals(null));
assertEquals("5", fValue.hashCode(), fVM.mirrorOf(12345).hashCode());
- assertTrue("6", fValue.hashCode() != fVM.mirrorOf(54321).hashCode());
+ assertNotEquals("6", fValue.hashCode(), fVM.mirrorOf(54321).hashCode());
}
/**
* Test JDI value().
*/
public void testJDIValue() {
- assertTrue("1", 12345 == fValue.value());
+ assertEquals("1", 12345, fValue.value());
}
}
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/InterfaceTypeTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/InterfaceTypeTest.java
index 4498ee2..750bdf8 100644
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/InterfaceTypeTest.java
+++ b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/InterfaceTypeTest.java
@@ -75,7 +75,7 @@
found = true;
}
}
- assertTrue("1", fType.allMethods().size() == 1);
+ assertEquals("1", 1, fType.allMethods().size());
assertTrue("2", found);
}
/**
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/LocalVariableTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/LocalVariableTest.java
index b7d957f..6837c0c 100644
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/LocalVariableTest.java
+++ b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/LocalVariableTest.java
@@ -14,6 +14,8 @@
package org.eclipse.debug.jdi.tests;
+import static org.junit.Assert.assertNotEquals;
+
import com.sun.jdi.AbsentInformationException;
import com.sun.jdi.ClassNotLoadedException;
import com.sun.jdi.LocalVariable;
@@ -65,18 +67,18 @@
try {
other = getFrame(RUN_FRAME_OFFSET).visibleVariableByName("o");
} catch (AbsentInformationException e) {
- assertTrue("2", false);
+ fail("2");
}
- assertTrue("3", !fVar.equals(other));
- assertTrue("4", !fVar.equals(new Object()));
- assertTrue("5", !fVar.equals(null));
- assertTrue("6", fVar.hashCode() != other.hashCode());
+ assertFalse("3", fVar.equals(other));
+ assertFalse("4", fVar.equals(new Object()));
+ assertFalse("5", fVar.equals(null));
+ assertNotEquals("6", fVar.hashCode(), other.hashCode());
}
/**
* Test JDI isArgument().
*/
public void testJDIIsArgument() {
- assertTrue("1", !fVar.isArgument());
+ assertFalse("1", fVar.isArgument());
}
/**
* Test JDI isVisible(StackFrame).
@@ -114,7 +116,7 @@
fVM.classesByName("java.lang.Thread").get(0),
fVar.type());
} catch (ClassNotLoadedException e) {
- assertTrue("2", false);
+ fail("2");
}
}
/**
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/LocatableTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/LocatableTest.java
index 9918622..94e5a40 100644
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/LocatableTest.java
+++ b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/LocatableTest.java
@@ -121,11 +121,11 @@
while (iterator.hasNext()) {
Locatable locatable = (Locatable) iterator.next();
Location location = locatable.location();
- assertTrue("1." + locatable, location != null);
+ assertNotNull("1." + locatable, location);
assertTrue(
"2." + locatable,
(location.codeIndex()) >= 0 || (location.codeIndex() == -1));
- assertTrue("3." + locatable, location.declaringType() != null);
+ assertNotNull("3." + locatable, location.declaringType());
assertTrue(
"4." + locatable,
(location.lineNumber() > 0) || (location.lineNumber() == -1));
@@ -133,7 +133,7 @@
try {
location.sourceName();
} catch (AbsentInformationException e) {
- assertTrue("7", false);
+ fail("7");
}
}
}
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/LocationTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/LocationTest.java
index f6b7d1c..f876369 100644
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/LocationTest.java
+++ b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/LocationTest.java
@@ -13,6 +13,8 @@
*******************************************************************************/
package org.eclipse.debug.jdi.tests;
+import static org.junit.Assert.assertNotEquals;
+
import com.sun.jdi.AbsentInformationException;
import com.sun.jdi.Location;
import com.sun.jdi.Method;
@@ -79,10 +81,10 @@
public void testJDIEquality() {
assertTrue("1", fLocation.equals(fLocation));
Location other = getFrame(0).location();
- assertTrue("2", !fLocation.equals(other));
- assertTrue("3", !fLocation.equals(new Object()));
- assertTrue("4", !fLocation.equals(null));
- assertTrue("5", fLocation.hashCode() != other.hashCode());
+ assertFalse("2", fLocation.equals(other));
+ assertFalse("3", fLocation.equals(new Object()));
+ assertFalse("4", fLocation.equals(null));
+ assertNotEquals("5", fLocation.hashCode(), other.hashCode());
}
/**
* Test JDI lineNumber().
@@ -105,7 +107,7 @@
try {
sourceName = fLocation.sourceName();
} catch (AbsentInformationException e) {
- assertTrue("1", false);
+ fail("1");
}
assertEquals("2", "MainClass.java", sourceName);
}
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/LongValueTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/LongValueTest.java
index 4f4246d..ae048a7 100644
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/LongValueTest.java
+++ b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/LongValueTest.java
@@ -13,6 +13,8 @@
*******************************************************************************/
package org.eclipse.debug.jdi.tests;
+import static org.junit.Assert.assertNotEquals;
+
import com.sun.jdi.LongValue;
/**
@@ -55,19 +57,19 @@
*/
public void testJDIEquality() {
assertTrue("1", fValue.equals(fVM.mirrorOf(123456789l)));
- assertTrue("2", !fValue.equals(fVM.mirrorOf(987654321l)));
- assertTrue("3", !fValue.equals(new Object()));
- assertTrue("4", !fValue.equals(null));
+ assertFalse("2", fValue.equals(fVM.mirrorOf(987654321l)));
+ assertFalse("3", fValue.equals(new Object()));
+ assertFalse("4", fValue.equals(null));
assertEquals(
"5",
fValue.hashCode(),
fVM.mirrorOf(123456789l).hashCode());
- assertTrue("6", fValue.hashCode() != fVM.mirrorOf(987654321l).hashCode());
+ assertNotEquals("6", fValue.hashCode(), fVM.mirrorOf(987654321l).hashCode());
}
/**
* Test JDI value().
*/
public void testJDIValue() {
- assertTrue("1", 123456789l == fValue.value());
+ assertEquals("1", 123456789l, fValue.value());
}
}
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/MethodEntryRequestTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/MethodEntryRequestTest.java
index cc07931..38dd0ed 100644
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/MethodEntryRequestTest.java
+++ b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/MethodEntryRequestTest.java
@@ -93,7 +93,7 @@
MethodEntryEvent event = (MethodEntryEvent) e;
Method m = event.method();
ReferenceType r = m.location().declaringType();
- assertTrue("1", !r.name().startsWith("org.eclipse.debug.jdi.tests.program."));
+ assertFalse("1", r.name().startsWith("org.eclipse.debug.jdi.tests.program."));
fVM.eventRequestManager().deleteEventRequest(request);
}
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/MethodExitRequestTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/MethodExitRequestTest.java
index f65b385..e12d54e 100644
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/MethodExitRequestTest.java
+++ b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/MethodExitRequestTest.java
@@ -91,7 +91,7 @@
MethodExitEvent event = (MethodExitEvent) e;
Method m = event.method();
ReferenceType r = m.location().declaringType();
- assertTrue("1", !r.name().startsWith("org.eclipse.debug.jdi.tests.program."));
+ assertFalse("1", r.name().startsWith("org.eclipse.debug.jdi.tests.program."));
fVM.eventRequestManager().deleteEventRequest(request);
}
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/MethodReturnValuesTests.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/MethodReturnValuesTests.java
index 2b59752..9d871b1 100644
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/MethodReturnValuesTests.java
+++ b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/MethodReturnValuesTests.java
@@ -103,12 +103,12 @@
assertEquals(req, event.request());
val = event.returnValue();
assertNotNull("value should not be null", val);
- assertTrue("return value must be void", val.equals(val.virtualMachine().mirrorOfVoid()));
+ assertEquals("return value must be void", val, val.virtualMachine().mirrorOfVoid());
erm.deleteEventRequest(req);
}
}
catch (InterruptedException e) {
- assertTrue("thrown exception mean failure", false);
+ fail("thrown exception mean failure");
}
}
@@ -150,7 +150,7 @@
}
}
catch (InterruptedException e) {
- assertTrue("thrown exception mean failure", false);
+ fail("thrown exception mean failure");
}
}
@@ -192,7 +192,7 @@
}
}
catch (InterruptedException e) {
- assertTrue("thrown exception mean failure", false);
+ fail("thrown exception mean failure");
}
}
@@ -234,7 +234,7 @@
}
}
catch (InterruptedException e) {
- assertTrue("thrown exception mean failure", false);
+ fail("thrown exception mean failure");
}
}
@@ -276,7 +276,7 @@
}
}
catch (InterruptedException e) {
- assertTrue("thrown exception mean failure", false);
+ fail("thrown exception mean failure");
}
}
}
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/MethodTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/MethodTest.java
index cfcd94c..dd4a7fb 100644
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/MethodTest.java
+++ b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/MethodTest.java
@@ -13,6 +13,8 @@
*******************************************************************************/
package org.eclipse.debug.jdi.tests;
+import static org.junit.Assert.assertNotEquals;
+
import java.util.List;
import com.sun.jdi.AbsentInformationException;
@@ -70,7 +72,7 @@
try {
arguments = fMethod1.arguments();
} catch (AbsentInformationException e) {
- assertTrue("1", false);
+ fail("1");
}
assertEquals("2", 2, arguments.size());
assertEquals("3", "t", ((LocalVariable) arguments.get(0)).name());
@@ -96,7 +98,7 @@
try {
types = fMethod1.argumentTypes();
} catch (ClassNotLoadedException e) {
- assertTrue("1", false);
+ fail("1");
}
assertEquals("2", 2, types.size());
assertEquals("3", fVM.classesByName("java.lang.Thread").get(0), types.get(0));
@@ -109,8 +111,9 @@
* Test JDI bytecodes().
*/
public void testJDIBytecodes() {
- if (!fVM.canGetBytecodes())
+ if (!fVM.canGetBytecodes()) {
return;
+ }
byte[] bytecodes = fMethod1.bytecodes();
assertEquals("1", 27, bytecodes.length);
@@ -121,40 +124,40 @@
public void testJDIEquality() {
assertTrue("1", fMethod1.equals(fMethod1));
Method other = getMethod("run", "()V");
- assertTrue("2", !fMethod1.equals(other));
- assertTrue("3", !fMethod1.equals(new Object()));
- assertTrue("4", !fMethod1.equals(null));
- assertTrue("5", fMethod1.hashCode() != other.hashCode());
+ assertFalse("2", fMethod1.equals(other));
+ assertFalse("3", fMethod1.equals(new Object()));
+ assertFalse("4", fMethod1.equals(null));
+ assertNotEquals("5", fMethod1.hashCode(), other.hashCode());
}
/**
* Test JDI isAbstract().
*/
public void testJDIIsAbstract() {
- assertTrue("1", !fMethod1.isAbstract());
+ assertFalse("1", fMethod1.isAbstract());
}
/**
* Test JDI isConstructor().
*/
public void testJDIIsConstructor() {
- assertTrue("1", !fMethod1.isConstructor());
+ assertFalse("1", fMethod1.isConstructor());
}
/**
* Test JDI isNative().
*/
public void testJDIIsNative() {
- assertTrue("1", !fMethod1.isNative());
+ assertFalse("1", fMethod1.isNative());
}
/**
* Test JDI isStaticInitializer().
*/
public void testJDIIsStaticInitializer() {
- assertTrue("1", !fMethod1.isStaticInitializer());
+ assertFalse("1", fMethod1.isStaticInitializer());
}
/**
* Test JDI isSynchronized().
*/
public void testJDIIsSynchronized() {
- assertTrue("1", !fMethod1.isSynchronized());
+ assertFalse("1", fMethod1.isSynchronized());
}
/**
* Test JDI locationOfCodeIndex(long).
@@ -173,7 +176,7 @@
try {
locations = fMethod1.locationsOfLine(expected);
} catch (AbsentInformationException e) {
- assertTrue("1", false);
+ fail("1");
}
assertEquals("2", 1, locations.size());
assertEquals("3", expected, ((Location) locations.get(0)).lineNumber());
@@ -185,7 +188,7 @@
try {
assertTrue("1", fMethod1.returnType() instanceof VoidType);
} catch (ClassNotLoadedException e) {
- assertTrue("2", false);
+ fail("2");
}
}
/**
@@ -202,7 +205,7 @@
try {
variables = fMethod1.variables();
} catch (AbsentInformationException e) {
- assertTrue("1", false);
+ fail("1");
}
assertEquals("2", 2, variables.size());
assertEquals("3", "t", ((LocalVariable) variables.get(0)).name());
@@ -223,10 +226,10 @@
assertFalse("1", "1.3".equals(fVM.version()));
return;
} catch (NativeMethodException nme) {
- assertTrue("1", "1.3".equals(fVM.version()));
+ assertEquals("1", "1.3", fVM.version());
return;
}
- assertTrue("Should have thrown native method exception", false);
+ fail("Should have thrown native method exception");
}
/**
@@ -240,7 +243,7 @@
try {
variables = method.variables();
} catch (AbsentInformationException e) {
- assertTrue("1", false);
+ fail("1");
}
assertEquals("1", 1, variables.size());
}
@@ -254,7 +257,7 @@
try {
variables = fMethod1.variablesByName(varName);
} catch (AbsentInformationException e) {
- assertTrue("1", false);
+ fail("1");
}
assertEquals("2", 1, variables.size());
assertEquals("3", varName, ((LocalVariable) variables.get(0)).name());
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/MonitorFrameInfoTests.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/MonitorFrameInfoTests.java
index 0c8d010..dd6d6a7 100644
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/MonitorFrameInfoTests.java
+++ b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/MonitorFrameInfoTests.java
@@ -43,7 +43,7 @@
assertTrue("Should have monitor frame info", fVM.canGetMonitorFrameInfo());
}
else {
- assertTrue("Should not have monitor frame info", !fVM.canGetMonitorFrameInfo());
+ assertFalse("Should not have monitor frame info", fVM.canGetMonitorFrameInfo());
}
}
@@ -67,7 +67,7 @@
ThreadReference tref = bpe.thread();
List<?> list = tref.ownedMonitorsAndFrames();
assertNotNull("list cannot be null", list);
- assertTrue("there should be one monitor", list.size() == 1);
+ assertEquals("there should be one monitor", 1, list.size());
fEventReader.removeEventListener(waiter);
tref.resume();
} catch (InterruptedException e) {
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ObjectReferenceTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ObjectReferenceTest.java
index df305c2..5bd3488 100644
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ObjectReferenceTest.java
+++ b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ObjectReferenceTest.java
@@ -13,6 +13,8 @@
*******************************************************************************/
package org.eclipse.debug.jdi.tests;
+import static org.junit.Assert.assertNotEquals;
+
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedList;
@@ -21,8 +23,6 @@
import java.util.Map;
import java.util.Vector;
-import junit.framework.Test;
-
import com.sun.jdi.ClassNotLoadedException;
import com.sun.jdi.ClassType;
import com.sun.jdi.Field;
@@ -38,6 +38,8 @@
import com.sun.jdi.Value;
import com.sun.jdi.event.ThreadStartEvent;
+import junit.framework.Test;
+
/**
* Tests for JDI com.sun.jdi.ObjectReference
* and JDWP Object command set.
@@ -105,7 +107,7 @@
* Test JDI disableCollection(). enableCollection() and isCollected().
*/
public void testJDIDisableEnableCollection() {
- assertTrue("1", !fObject.isCollected());
+ assertFalse("1", fObject.isCollected());
fObject.disableCollection();
fObject.enableCollection();
}
@@ -121,7 +123,7 @@
try {
assertEquals("1", 1, fObject.entryCount());
} catch (IncompatibleThreadStateException e) {
- assertTrue("2", false);
+ fail("2");
}
}
}
@@ -131,10 +133,10 @@
public void testJDIEquality() {
assertTrue("1", fObject.equals(fObject));
ObjectReference other = getThread();
- assertTrue("2", !fObject.equals(other));
- assertTrue("3", !fObject.equals(new Object()));
- assertTrue("4", !fObject.equals(null));
- assertTrue("5", fObject.hashCode() != other.hashCode());
+ assertFalse("2", fObject.equals(other));
+ assertFalse("3", fObject.equals(new Object()));
+ assertFalse("4", fObject.equals(null));
+ assertNotEquals("5", fObject.hashCode(), other.hashCode());
}
/**
* Test JDI getValue(Field), getValues(List) and setValue(Field,Value)
@@ -148,15 +150,16 @@
List<Field> instanceFields = new LinkedList<>();
while (iterator.hasNext()) {
Field field = (Field) iterator.next();
- if (!field.isStatic())
+ if (!field.isStatic()) {
instanceFields.add(field);
+ }
}
Field field = instanceFields.get(4);
assertEquals("1", "fChar", field.name());
// getValues(List)
Map<?, ?> values = fObject.getValues(instanceFields);
- assertTrue("2", values.size() == 7);
+ assertEquals("2", 7, values.size());
Value value = (Value) values.get(field);
assertEquals("3", value, fVM.mirrorOf('a'));
@@ -165,9 +168,9 @@
try {
fObject.setValue(field, newValue);
} catch (ClassNotLoadedException e) {
- assertTrue("4.1", false);
+ fail("4.1");
} catch (InvalidTypeException e) {
- assertTrue("4.2", false);
+ fail("4.2");
}
// getValue(Field)
@@ -180,13 +183,13 @@
try {
fObject.setValue(field, null);
} catch (ClassNotLoadedException e) {
- assertTrue("7.1", false);
+ fail("7.1");
} catch (InvalidTypeException e) {
- assertTrue("7.2", false);
+ fail("7.2");
}
// getValue(Field)
- assertEquals("8", fObject.getValue(field), null);
+ assertNull("8", fObject.getValue(field));
// test get final value.
field = instanceFields.get(6);
@@ -232,8 +235,9 @@
} catch (InvocationException exc) {
oops = exc;
}
- assertTrue("1", oops == null);
- assertEquals("2", val == null ? 0 : ((IntegerValue) val).value(), 888);
+ assertNull("1", oops);
+ assertNotNull("2", val);
+ assertEquals("2", 888, ((IntegerValue) val).value());
}
/**
* Test JDI invokeMethod - failure.
@@ -266,8 +270,8 @@
} catch (InvocationException exc) {
good = exc;
}
- assertTrue("1", oops == null);
- assertTrue("2", good != null);
+ assertNull("1", oops);
+ assertNotNull("2", good);
}
/**
* Test JDI owningThread().
@@ -281,7 +285,7 @@
try {
assertEquals("1", getThread(), fObject.owningThread());
} catch (IncompatibleThreadStateException e) {
- assertTrue("2", false);
+ fail("2");
}
}
}
@@ -290,7 +294,7 @@
*/
public void testJDIReferenceType() {
ReferenceType type = fObject.referenceType();
- assertEquals("1", type.name(), "org.eclipse.debug.jdi.tests.program.MainClass");
+ assertEquals("1", "org.eclipse.debug.jdi.tests.program.MainClass", type.name());
}
/**
* Test JDI uniqueID().
@@ -306,7 +310,7 @@
try {
assertEquals("1", 0, fObject.waitingThreads().size());
} catch (IncompatibleThreadStateException e) {
- assertTrue("2", false);
+ fail("2");
}
}
}
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ReferenceTypeTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ReferenceTypeTest.java
index 18e3fdd..dd0f707 100644
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ReferenceTypeTest.java
+++ b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ReferenceTypeTest.java
@@ -13,6 +13,8 @@
*******************************************************************************/
package org.eclipse.debug.jdi.tests;
+import static org.junit.Assert.assertNotEquals;
+
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
@@ -89,8 +91,9 @@
ReferenceType type = iterator.next();
Iterator<?> all = type.allFields().iterator();
int i = 0;
- while (all.hasNext())
+ while (all.hasNext()) {
assertTrue("1." + type.name() + "." + i++, all.next() instanceof Field);
+ }
}
}
/**
@@ -102,8 +105,9 @@
ReferenceType type = iterator.next();
Iterator<?> all = type.allMethods().iterator();
int i = 0;
- while (all.hasNext())
+ while (all.hasNext()) {
assertTrue("1." + type.name() + "." + i++, all.next() instanceof Method);
+ }
}
}
/**
@@ -113,7 +117,7 @@
for (int i = 0; i < fTypes.size(); ++i) {
ReferenceType type = fTypes.get(i);
ObjectReference classLoader = type.classLoader();
- assertTrue("1." + i, (classLoader == null) == fSystemClassLoader[i]);
+ assertEquals("1." + i, (classLoader == null), fSystemClassLoader[i]);
}
}
/**
@@ -123,7 +127,7 @@
ListIterator<ReferenceType> iterator = fTypes.listIterator();
while (iterator.hasNext()) {
ReferenceType type = iterator.next();
- assertTrue(type.name(), type.classObject() != null);
+ assertNotNull(type.name(), type.classObject());
}
}
/**
@@ -136,11 +140,11 @@
while (iterator.hasNext()) {
ReferenceType type = iterator.next();
assertTrue("1." + type.name() + ".1", type.equals(type));
- assertTrue("1." + type.name() + ".2", !type.equals(other));
- assertTrue("1." + type.name() + ".3", !type.equals(fVM));
- assertTrue("1." + type.name() + ".4", !type.equals(new Object()));
- assertTrue("1." + type.name() + ".5", !type.equals(null));
- assertTrue("1." + type.name() + ".6", type.hashCode() != other.hashCode());
+ assertFalse("1." + type.name() + ".2", type.equals(other));
+ assertFalse("1." + type.name() + ".3", type.equals(fVM));
+ assertFalse("1." + type.name() + ".4", type.equals(new Object()));
+ assertFalse("1." + type.name() + ".5", type.equals(null));
+ assertNotEquals("1." + type.name() + ".6", type.hashCode(), other.hashCode());
}
}
/**
@@ -150,7 +154,7 @@
ListIterator<ReferenceType> iterator = fTypes.listIterator();
while (iterator.hasNext()) {
ReferenceType type = iterator.next();
- assertTrue("1." + type.name(), !type.failedToInitialize());
+ assertFalse("1." + type.name(), type.failedToInitialize());
}
}
/**
@@ -160,7 +164,7 @@
// NB: This tests the class type only, it should test the others too
ReferenceType type = fTypes.get(fMainClassIndex);
Field field = type.fieldByName("fObject");
- assertTrue("1." + type.name(), field != null);
+ assertNotNull("1." + type.name(), field);
}
/**
* Test JDI fields() and JDWP 'Type - Get Fields'.
@@ -171,8 +175,9 @@
ReferenceType type = iterator.next();
Iterator<?> fields = type.fields().iterator();
int i = 0;
- while (fields.hasNext())
+ while (fields.hasNext()) {
assertTrue("1." + i++ +"." + type.name(), fields.next() instanceof Field);
+ }
}
}
/**
@@ -182,7 +187,7 @@
// NB: This tests the class type only, it should test the others too
ReferenceType type = fTypes.get(fMainClassIndex);
Field field = type.fieldByName("fInt");
- assertTrue("1." + type.name(), field != null);
+ assertNotNull("1." + type.name(), field);
assertTrue("2." + type.name(), type.getValue(field) instanceof IntegerValue);
}
/**
@@ -198,8 +203,9 @@
List<Field> staticFields = new LinkedList<>();
while (iterator.hasNext()) {
Field field = (Field) iterator.next();
- if (field.isStatic())
+ if (field.isStatic()) {
staticFields.add(field);
+ }
}
Map<?, ?> values = type.getValues(staticFields);
assertEquals("1." + type.name(), 24, values.size());
@@ -207,8 +213,9 @@
// Get value of field fInt in MainClass
Field field = staticFields.get(0);
int i = 0;
- while (!field.name().equals("fInt"))
+ while (!field.name().equals("fInt")) {
field = staticFields.get(++i);
+ }
// Ensure it is an integer value
assertTrue("2." + type.name(), values.get(field) instanceof IntegerValue);
@@ -220,10 +227,11 @@
ListIterator<ReferenceType> iterator = fTypes.listIterator();
while (iterator.hasNext()) {
ReferenceType type = iterator.next();
- if (type.name().equals("org.eclipse.debug.jdi.tests.program.Printable"))
+ if (type.name().equals("org.eclipse.debug.jdi.tests.program.Printable")) {
assertTrue("1." + type.name(), type.isAbstract());
- else
- assertTrue("2." + type.name(), !type.isAbstract());
+ } else {
+ assertFalse("2." + type.name(), type.isAbstract());
+ }
}
}
/**
@@ -232,7 +240,7 @@
public void testJDIIsFinal() {
for (int i = 0; i < fTypes.size(); ++i) {
ReferenceType type = fTypes.get(i);
- assertTrue("1." + i, type.isFinal() == fIsFinal[i]);
+ assertEquals("1." + i, type.isFinal(), fIsFinal[i]);
}
}
/**
@@ -262,7 +270,7 @@
ListIterator<ReferenceType> iterator = fTypes.listIterator();
while (iterator.hasNext()) {
ReferenceType type = iterator.next();
- assertTrue("1." + type.name(), !type.isStatic());
+ assertFalse("1." + type.name(), type.isStatic());
}
}
/**
@@ -283,7 +291,7 @@
for (int i = 0; i < fTypes.size(); ++i) {
ReferenceType type = fTypes.get(i);
List<?> methods = type.methods();
- assertTrue("" + i, (!methods.isEmpty()) == fHasMethods[i]);
+ assertNotEquals("" + i, methods.isEmpty(), fHasMethods[i]);
}
}
/**
@@ -296,14 +304,16 @@
// methodsByName(String)
Iterator<?> methods = type.methodsByName("run").iterator();
- while (methods.hasNext())
+ while (methods.hasNext()) {
assertTrue("1." + type.name(), methods.next() instanceof Method);
+ }
assertEquals("2", 0, type.methodsByName("fraz").size());
// methodsByName(String, String)
methods = type.methodsByName("run", "()V").iterator();
- while (methods.hasNext())
+ while (methods.hasNext()) {
assertTrue("3." + type.name(), methods.next() instanceof Method);
+ }
assertEquals("4", 0, type.methodsByName("fraz", "()Z").size());
}
}
@@ -316,10 +326,10 @@
ReferenceType type = fTypes.get(i);
if (i != 2) {
// i == 2 corresponds to an ArrayType, isAbstract() is undefined
- assertTrue("1." + i, type.isAbstract() == fIsAbstract[i]);
+ assertEquals("1." + i, type.isAbstract(), fIsAbstract[i]);
}
- assertTrue("2." + i, type.isFinal() == fIsFinal[i]);
- assertTrue("3." + i, type.isStatic() == fIsStatic[i]);
+ assertEquals("2." + i, type.isFinal(), fIsFinal[i]);
+ assertEquals("3." + i, type.isStatic(), fIsStatic[i]);
}
}
/**
@@ -337,7 +347,7 @@
public void testJDINestedTypes() {
// NB: This tests the class type only, it should test the others too
ReferenceType type = getClass("org.eclipse.debug.jdi.tests.program.OtherClass");
- assertTrue("1." + type.name(), type != null);
+ assertNotNull("1." + type.name(), type);
List<?> nestedTypes = type.nestedTypes();
assertEquals("2." + type.name(), 1, nestedTypes.size());
assertTrue("3." + type.name(), nestedTypes.get(0) instanceof ReferenceType);
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ShortValueTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ShortValueTest.java
index 1cd664b..78f93df 100644
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ShortValueTest.java
+++ b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ShortValueTest.java
@@ -13,6 +13,8 @@
*******************************************************************************/
package org.eclipse.debug.jdi.tests;
+import static org.junit.Assert.assertNotEquals;
+
import com.sun.jdi.ShortValue;
/**
@@ -55,21 +57,19 @@
*/
public void testJDIEquality() {
assertTrue("1", fValue.equals(fVM.mirrorOf((short) 12345)));
- assertTrue("2", !fValue.equals(fVM.mirrorOf((short) 54321)));
- assertTrue("3", !fValue.equals(new Object()));
- assertTrue("4", !fValue.equals(null));
+ assertFalse("2", fValue.equals(fVM.mirrorOf((short) 54321)));
+ assertFalse("3", fValue.equals(new Object()));
+ assertFalse("4", fValue.equals(null));
assertEquals(
"5",
fValue.hashCode(),
fVM.mirrorOf((short) 12345).hashCode());
- assertTrue(
- "6",
- fValue.hashCode() != fVM.mirrorOf((short) 54321).hashCode());
+ assertNotEquals("6", fValue.hashCode(), fVM.mirrorOf((short) 54321).hashCode());
}
/**
* Test JDI value().
*/
public void testJDIValue() {
- assertTrue("1", (short) 12345 == fValue.value());
+ assertEquals("1", (short) 12345, fValue.value());
}
}
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/SourceNameFilterTests.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/SourceNameFilterTests.java
index 9dd36cf..2dc49d2 100644
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/SourceNameFilterTests.java
+++ b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/SourceNameFilterTests.java
@@ -40,7 +40,7 @@
assertTrue("Should have source name filter capabilities", (fVM.canUseSourceNameFilters() ? true : true));
}
else {
- assertTrue("Should not have source name filter capabilities", !fVM.canUseSourceNameFilters());
+ assertFalse("Should not have source name filter capabilities", fVM.canUseSourceNameFilters());
}
}
@@ -58,7 +58,7 @@
request.addSourceNameFilter("*.java");
ClassPrepareEvent event = (ClassPrepareEvent) triggerAndWait(request, "ClassPrepareEvent1", true, 5000);
assertNotNull("event should not be null", event);
- assertEquals(event.referenceType().name(), "org.eclipse.debug.jdi.tests.program.TestClass1");
+ assertEquals("org.eclipse.debug.jdi.tests.program.TestClass1", event.referenceType().name());
rm.deleteEventRequest(request);
//filter is *Test3.java
@@ -66,7 +66,7 @@
request.addSourceNameFilter("*TestClass3.java");
event = (ClassPrepareEvent) triggerAndWait(request, "ClassPrepareEvent3", true, 5000);
assertNotNull("event should not be null", event);
- assertEquals(event.referenceType().name(), "org.eclipse.debug.jdi.tests.program.TestClass3");
+ assertEquals("org.eclipse.debug.jdi.tests.program.TestClass3", event.referenceType().name());
rm.deleteEventRequest(request);
//filter is *TestClazz6.java
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/StackFrameTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/StackFrameTest.java
index 92cc862..b99e367 100644
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/StackFrameTest.java
+++ b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/StackFrameTest.java
@@ -70,18 +70,18 @@
StackFrame otherFrame = getFrame(0);
// Not identical
- assertTrue("1", fFrame != sameFrame);
+ assertNotSame("1", fFrame, sameFrame);
// But equal
- assertTrue("2", fFrame.equals(sameFrame));
- assertTrue("3", fFrame.hashCode() == sameFrame.hashCode());
+ assertEquals("2", fFrame, sameFrame);
+ assertEquals("3", fFrame.hashCode(), sameFrame.hashCode());
- assertTrue("4", fFrame.equals(fFrame));
- assertTrue("5", fFrame.hashCode() == fFrame.hashCode());
+ assertEquals("4", fFrame, fFrame);
+ assertEquals("5", fFrame.hashCode(), fFrame.hashCode());
- assertTrue("6", !fFrame.equals(otherFrame));
+ assertFalse("6", fFrame.equals(otherFrame));
- assertTrue("7", !fFrame.equals(new Object()));
- assertTrue("8", !fFrame.equals(null));
+ assertFalse("7", fFrame.equals(new Object()));
+ assertFalse("8", fFrame.equals(null));
}
/**
* Test JDI location().
@@ -100,9 +100,9 @@
try {
fFrame.setValue(var, thread);
} catch (ClassNotLoadedException e) {
- assertTrue("1.1", false);
+ fail("1.1");
} catch (InvalidTypeException e) {
- assertTrue("1.2", false);
+ fail("1.2");
}
// getValue(LocalVariable)
@@ -122,13 +122,13 @@
try {
fFrame.setValue(var, null);
} catch (ClassNotLoadedException e) {
- assertTrue("4.1", false);
+ fail("4.1");
} catch (InvalidTypeException e) {
- assertTrue("4.2", false);
+ fail("4.2");
}
value = (ThreadReference) fFrame.getValue(getLocalVariable());
- assertEquals("5", null, value);
+ assertNull("5", value);
}
/**
@@ -154,15 +154,15 @@
try {
var = fFrame.visibleVariableByName("t");
} catch (AbsentInformationException e) {
- assertTrue("1", false);
+ fail("1");
}
assertEquals("2", getLocalVariable(), var);
try {
var = fFrame.visibleVariableByName("bogus");
} catch (AbsentInformationException e) {
- assertTrue("3", false);
+ fail("3");
}
- assertTrue("4", null == var);
+ assertNull("4", var);
}
/**
* Test JDI visibleVariables().
@@ -172,7 +172,7 @@
try {
vars = fFrame.visibleVariables();
} catch (AbsentInformationException e) {
- assertTrue("1", false);
+ fail("1");
}
assertEquals("2", 2, vars.size());
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/StepEventTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/StepEventTest.java
index 026f6f2..e66c5dc 100644
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/StepEventTest.java
+++ b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/StepEventTest.java
@@ -98,9 +98,7 @@
event = triggerStepAndWait(getThread(), request, 1000);
} catch (Error e) {
}
- if (event != null) {
- assertTrue("1", false);
- }
+ assertNull("1", event);
waitUntilReady();
fVM.eventRequestManager().deleteEventRequest(request);
@@ -112,9 +110,7 @@
event = triggerStepAndWait(getThread(), request, 1000);
} catch (Error e) {
}
- if (event != null) {
- assertTrue("1", false);
- }
+ assertNull("1", event);
waitUntilReady();
fVM.eventRequestManager().deleteEventRequest(request);
}
@@ -133,9 +129,7 @@
event = triggerStepAndWait(getThread(), request, 1000);
} catch (Error e) {
}
- if (event != null) {
- assertTrue("1", false);
- }
+ assertNull("1", event);
waitUntilReady();
fVM.eventRequestManager().deleteEventRequest(request);
}
@@ -154,9 +148,7 @@
event = triggerStepAndWait(getThread(), request, 1000);
} catch (Error e) {
}
- if (event != null) {
- assertTrue("1", false);
- }
+ assertNull("1", event);
waitUntilReady();
fVM.eventRequestManager().deleteEventRequest(request);
}
@@ -176,7 +168,7 @@
}
if (event != null) {
System.out.println(event.location().declaringType());
- assertTrue("1", false);
+ fail("1");
}
waitUntilReady();
fVM.eventRequestManager().deleteEventRequest(request);
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ThreadReferenceTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ThreadReferenceTest.java
index ab216e9..a4aa82f 100644
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ThreadReferenceTest.java
+++ b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/ThreadReferenceTest.java
@@ -70,9 +70,9 @@
public void testJDICurrentContendedMonitor() {
if (fVM.canGetCurrentContendedMonitor()) {
try {
- assertTrue("1", fThread.currentContendedMonitor() == null);
+ assertNull("1", fThread.currentContendedMonitor());
} catch (IncompatibleThreadStateException e) {
- assertTrue("2", false);
+ fail("2");
}
}
}
@@ -84,7 +84,7 @@
StackFrame frame = fThread.frame(0);
assertTrue("1", fThread.frames().contains(frame));
} catch (IncompatibleThreadStateException e) {
- assertTrue("2", false);
+ fail("2");
}
}
/**
@@ -95,7 +95,7 @@
int count = fThread.frameCount();
assertTrue("1", count <= 4);
} catch (IncompatibleThreadStateException e) {
- assertTrue("2", false);
+ fail("2");
}
}
/**
@@ -106,7 +106,7 @@
try {
frames = fThread.frames();
} catch (IncompatibleThreadStateException e) {
- assertTrue("1", false);
+ fail("1");
}
assertTrue("2", frames.size() > 0);
}
@@ -122,7 +122,7 @@
* Test JDI isAtBreakpoint().
*/
public void testJDIIsAtBreakpoint() {
- assertTrue("1", !fThread.isAtBreakpoint());
+ assertFalse("1", fThread.isAtBreakpoint());
}
/**
* Test JDI isSuspended().
@@ -145,7 +145,7 @@
try {
assertEquals("1", 1, fThread.ownedMonitors().size());
} catch (IncompatibleThreadStateException e) {
- assertTrue("2", false);
+ fail("2");
}
}
}
@@ -180,7 +180,7 @@
// Create a java.lang.Throwable instance in
List<ReferenceType> classes = fVM.classesByName("java.lang.Throwable");
- assertTrue("1", !classes.isEmpty());
+ assertFalse("1", classes.isEmpty());
ClassType threadDeathClass = (ClassType) classes.get(0);
Method constructor =
threadDeathClass.concreteMethodByName("<init>", "()V");
@@ -195,20 +195,20 @@
threadDeath.disableCollection();
// This object is going to be used for the lifetime of the VM.
} catch (ClassNotLoadedException e) {
- assertTrue("2", false);
+ fail("2");
} catch (InvalidTypeException e) {
- assertTrue("3", false);
+ fail("3");
} catch (InvocationException e) {
- assertTrue("4", false);
+ fail("4");
} catch (IncompatibleThreadStateException e) {
- assertTrue("5", false);
+ fail("5");
}
// Stop the thread
try {
thread.stop(threadDeath);
} catch (InvalidTypeException e) {
- assertTrue("6", false);
+ fail("6");
}
waitUntilReady();
@@ -221,7 +221,7 @@
public void testJDISuspendResume() {
assertEquals("1", 1, fThread.suspendCount());
fThread.resume();
- assertTrue("2", !fThread.isSuspended());
+ assertFalse("2", fThread.isSuspended());
fThread.suspend();
assertTrue("3", fThread.isSuspended());
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/TypeComponentTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/TypeComponentTest.java
index 509d7b5..00a7f25 100644
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/TypeComponentTest.java
+++ b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/TypeComponentTest.java
@@ -70,15 +70,15 @@
* Test JDI isFinal().
*/
public void testJDIIsFinal() {
- assertTrue("1", !fField.isFinal());
- assertTrue("2", !fMethod.isFinal());
+ assertFalse("1", fField.isFinal());
+ assertFalse("2", fMethod.isFinal());
}
/**
* Test JDI isStatic().
*/
public void testJDIIsStatic() {
assertTrue("1", fField.isStatic());
- assertTrue("2", !fMethod.isStatic());
+ assertFalse("2", fMethod.isStatic());
}
/**
* Test JDI isSynthetic().
@@ -88,8 +88,8 @@
return;
}
- assertTrue("1", !fField.isSynthetic());
- assertTrue("2", !fMethod.isSynthetic());
+ assertFalse("1", fField.isSynthetic());
+ assertFalse("2", fMethod.isSynthetic());
}
/**
* Test JDI name().
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/VMDisconnectEventTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/VMDisconnectEventTest.java
index 884b506..c97decf 100644
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/VMDisconnectEventTest.java
+++ b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/VMDisconnectEventTest.java
@@ -75,6 +75,6 @@
* Test that we received the event.
*/
public void testJDIVMDeath() {
- assertTrue("1", fVMDisconnectEvent != null);
+ assertNotNull("1", fVMDisconnectEvent);
}
}
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/VMDisposeTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/VMDisposeTest.java
index 6c2a7fd..e436449 100644
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/VMDisposeTest.java
+++ b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/VMDisposeTest.java
@@ -53,7 +53,7 @@
fVM.dispose();
try {
fVM.allThreads();
- assertTrue("1", false);
+ fail("1");
} catch (VMDisconnectedException e) {
}
@@ -62,7 +62,7 @@
connectToVM();
fVM.allThreads();
} catch (VMDisconnectedException e) {
- assertTrue("3", false);
+ fail("3");
}
}
}
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/VirtualMachineExitTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/VirtualMachineExitTest.java
index 261c80c..5aa37b1 100644
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/VirtualMachineExitTest.java
+++ b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/VirtualMachineExitTest.java
@@ -64,14 +64,14 @@
try {
fVM.exit(0);
} catch (VMDisconnectedException e) {
- assertTrue("1", false);
+ fail("1");
}
try {
Thread.sleep(200);
- assertTrue("2", !vmIsRunning());
+ assertFalse("2", vmIsRunning());
fVM.allThreads();
- assertTrue("3", false);
+ fail("3");
} catch (VMDisconnectedException e) {
} catch (InterruptedException e) {
}
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/VirtualMachineTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/VirtualMachineTest.java
index 55eb48e..84f769d 100644
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/VirtualMachineTest.java
+++ b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/VirtualMachineTest.java
@@ -18,8 +18,6 @@
import java.util.ListIterator;
import java.util.Vector;
-import junit.framework.Test;
-
import com.sun.jdi.BooleanValue;
import com.sun.jdi.ByteValue;
import com.sun.jdi.CharValue;
@@ -33,6 +31,8 @@
import com.sun.jdi.ThreadGroupReference;
import com.sun.jdi.ThreadReference;
+import junit.framework.Test;
+
/**
* Tests for JDI com.sun.jdi.VirtualMachine
* and JDWP VM command set.
@@ -184,7 +184,7 @@
public void testJDIMirrorOfBoolean() {
boolean value = true;
BooleanValue mirror = fVM.mirrorOf(value);
- assertTrue("1", value == mirror.value());
+ assertEquals("1", value, mirror.value());
}
/**
* Test JDI mirrorOf(byte).
@@ -268,7 +268,7 @@
*/
public void testJDIVersion() {
String version = fVM.version();
- assertTrue("1", version != null);
+ assertNotNull("1", version);
}
/**
* Test JDI allClasses() and JDWP 'VM - Get all classes'
@@ -278,8 +278,9 @@
List<?> classes = fVM.allClasses();
Iterator<?> iterator = classes.listIterator();
int i = 0;
- while (iterator.hasNext())
+ while (iterator.hasNext()) {
assertTrue(Integer.toString(i++), iterator.next() instanceof ReferenceType);
+ }
}
/**
* Test JDI allThreads() and JDWP 'VM - Get all threads'
@@ -289,8 +290,9 @@
List<?> threads = fVM.allThreads();
Iterator<?> iterator = threads.listIterator();
int i = 0;
- while (iterator.hasNext())
+ while (iterator.hasNext()) {
assertTrue(Integer.toString(i++), iterator.next() instanceof ThreadReference);
+ }
}
/**
* Test JDI classesByName() while the test program has not been started.
@@ -307,7 +309,7 @@
// The test program has started, the number of classes is != 0
List<?> classes = fVM.allClasses();
- assertTrue("1", !classes.isEmpty());
+ assertFalse("1", classes.isEmpty());
// Collect names of received classes
String[] names = new String[classes.size()];
@@ -344,7 +346,7 @@
// The test program has started, the number of threads is != 0
List<?> threads = fVM.allThreads();
- assertTrue("1", !threads.isEmpty());
+ assertFalse("1", threads.isEmpty());
// Collect names of received threads
String[] names = new String[threads.size()];
@@ -375,7 +377,7 @@
// The test program has started, the number of java.lang.Object is 1
List<?> classes = fVM.classesByName("java.lang.Object");
- assertEquals("1", classes.size(), 1);
+ assertEquals("1", 1, classes.size());
// Collect names of received classes
String[] names = new String[classes.size()];
diff --git a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/WatchpointEventTest.java b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/WatchpointEventTest.java
index 6a556f2..69cfe70 100644
--- a/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/WatchpointEventTest.java
+++ b/org.eclipse.jdt.debug.jdi.tests/tests/org/eclipse/debug/jdi/tests/WatchpointEventTest.java
@@ -48,7 +48,7 @@
(AccessWatchpointEvent) triggerAndWait(getAccessWatchpointRequest(),
"AccessWatchpointEvent",
true);
- assertTrue("Got access watchpoint event", fAccessWatchpointEvent != null);
+ assertNotNull("Got access watchpoint event", fAccessWatchpointEvent);
// Trigger a static access watchpoint event
fStaticAccessWatchpointEvent =
@@ -56,9 +56,7 @@
getStaticAccessWatchpointRequest(),
"StaticAccessWatchpointEvent",
true);
- assertTrue(
- "Got static access watchpoint event",
- fStaticAccessWatchpointEvent != null);
+ assertNotNull("Got static access watchpoint event", fStaticAccessWatchpointEvent);
// Trigger a modification watchpoint event
fModificationWatchpointEvent =
@@ -67,9 +65,7 @@
"ModificationWatchpointEvent",
false);
// Interrupt the VM so that we can test valueCurrent()
- assertTrue(
- "Got modification watchpoint event",
- fModificationWatchpointEvent != null);
+ assertNotNull("Got modification watchpoint event", fModificationWatchpointEvent);
}
/**
@@ -128,7 +124,7 @@
"1",
getObjectReference(),
fAccessWatchpointEvent.object());
- assertTrue("2", fStaticAccessWatchpointEvent.object() == null);
+ assertNull("2", fStaticAccessWatchpointEvent.object());
assertEquals(
"3",
getObjectReference(),
@@ -138,10 +134,7 @@
* Test JDI valueCurrent().
*/
public void testJDIValueCurrent() {
- assertTrue(
- "1",
- false
- == ((BooleanValue) fAccessWatchpointEvent.valueCurrent()).value());
+ assertFalse("1", ((BooleanValue) fAccessWatchpointEvent.valueCurrent()).value());
assertEquals(
"2",
@@ -149,10 +142,7 @@
((StringReference) fStaticAccessWatchpointEvent.valueCurrent())
.value());
- assertTrue(
- "3",
- false
- == ((BooleanValue) fModificationWatchpointEvent.valueCurrent())
- .value());
+ assertFalse("3", ((BooleanValue) fModificationWatchpointEvent.valueCurrent())
+ .value());
}
}
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/test/stepping/ForceReturnTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/test/stepping/ForceReturnTests.java
index f258a8b..589468a 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/test/stepping/ForceReturnTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/test/stepping/ForceReturnTests.java
@@ -307,7 +307,7 @@
assertTrue("Should be invalid type exception", e.getStatus().getException() instanceof InvalidTypeException);
return;
}
- assertTrue("Should have caused incompatible return type exception", false);
+ fail("Should have caused incompatible return type exception");
}
} finally {
terminateAndRemove(thread);
@@ -339,7 +339,7 @@
assertTrue("Should be invalid type exception", e.getStatus().getException() instanceof InvalidTypeException);
return;
}
- assertTrue("Should have caused incompatible return type exception", false);
+ fail("Should have caused incompatible return type exception");
}
} finally {
terminateAndRemove(thread);
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AbstractDebugTest.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AbstractDebugTest.java
index 55490c5..6ad4b65 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AbstractDebugTest.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AbstractDebugTest.java
@@ -1384,12 +1384,12 @@
IJavaThread thread = (IJavaThread) suspendee;
IBreakpoint hit = getBreakpoint(thread);
assertNotNull("suspended, but not by breakpoint", hit); //$NON-NLS-1$
- assertTrue("hit un-registered breakpoint", bp.equals(hit)); //$NON-NLS-1$
+ assertEquals("hit un-registered breakpoint", bp, hit); //$NON-NLS-1$
assertTrue("suspended, but not by line breakpoint", hit instanceof ILineBreakpoint); //$NON-NLS-1$
ILineBreakpoint breakpoint= (ILineBreakpoint) hit;
int lineNumber = breakpoint.getLineNumber();
int stackLine = thread.getTopStackFrame().getLineNumber();
- assertTrue("line numbers of breakpoint and stack frame do not match", lineNumber == stackLine); //$NON-NLS-1$
+ assertEquals("line numbers of breakpoint and stack frame do not match", lineNumber, stackLine); //$NON-NLS-1$
return thread;
}
@@ -1471,12 +1471,12 @@
IJavaThread thread = (IJavaThread) suspendee;
IBreakpoint hit = getBreakpoint(thread);
assertNotNull("suspended, but not by breakpoint", hit); //$NON-NLS-1$
- assertTrue("hit un-registered breakpoint", bp.equals(hit)); //$NON-NLS-1$
+ assertEquals("hit un-registered breakpoint", bp, hit); //$NON-NLS-1$
assertTrue("suspended, but not by line breakpoint", hit instanceof ILineBreakpoint); //$NON-NLS-1$
ILineBreakpoint breakpoint= (ILineBreakpoint) hit;
int lineNumber = breakpoint.getLineNumber();
int stackLine = thread.getTopStackFrame().getLineNumber();
- assertTrue("line numbers of breakpoint and stack frame do not match", lineNumber == stackLine); //$NON-NLS-1$
+ assertEquals("line numbers of breakpoint and stack frame do not match", lineNumber, stackLine); //$NON-NLS-1$
return (IJavaThread)suspendee;
}
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/ProjectCreationDecorator.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/ProjectCreationDecorator.java
index 22c329b..3ed31f5 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/ProjectCreationDecorator.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/ProjectCreationDecorator.java
@@ -85,7 +85,7 @@
IResource resource = root.findMember(outputLocation);
assertNotNull("Project output location is null", resource);
assertTrue("Project output location does not exist", resource.exists());
- assertTrue("Project output is not a folder", (resource.getType() == IResource.FOLDER));
+ assertEquals("Project output is not a folder", IResource.FOLDER, resource.getType());
IFolder folder = (IFolder) resource;
IResource[] children = folder.members();
assertTrue("output folder is empty", children.length > 0);
@@ -107,7 +107,7 @@
errors++;
}
}
- assertTrue("Unexpected compile errors in project. Expected 0 found " + markers.length, errors == 0);
+ assertEquals("Unexpected compile errors in project. Expected 0 found " + markers.length, 0, errors);
}
/**
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/BreakpointLocationVerificationTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/BreakpointLocationVerificationTests.java
index 3b42834..6a4a22d 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/BreakpointLocationVerificationTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/BreakpointLocationVerificationTests.java
@@ -84,7 +84,7 @@
typeName = typeName.replaceAll("\\$", ".");
}
if (lineNumber == -1) {
- assertEquals("Wrong type name", null, typeName);
+ assertNull("Wrong type name", typeName);
} else {
assertEquals("Wrong type name", expectedTypeName, typeName);
}
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/ConditionalBreakpointsTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/ConditionalBreakpointsTests.java
index 41086a4..8ed3797 100755
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/ConditionalBreakpointsTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/ConditionalBreakpointsTests.java
@@ -56,7 +56,7 @@
IJavaPrimitiveValue value = (IJavaPrimitiveValue)var.getValue();
assertNotNull("variable 'i' has no value", value);
int iValue = value.getIntValue();
- assertTrue("value of 'i' should be '3', but was " + iValue, iValue == 3);
+ assertEquals("value of 'i' should be '3', but was " + iValue, 3, iValue);
bp.delete();
} finally {
@@ -84,7 +84,7 @@
IJavaPrimitiveValue value = (IJavaPrimitiveValue)var.getValue();
assertNotNull("variable 'i' has no value", value);
int iValue = value.getIntValue();
- assertTrue("value of 'i' should be '4', but was " + iValue, iValue == 4);
+ assertEquals("value of 'i' should be '4', but was " + iValue, 4, iValue);
bp.delete();
} finally {
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/ExceptionBreakpointTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/ExceptionBreakpointTests.java
index 27459c2..64ba0e7 100755
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/ExceptionBreakpointTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/ExceptionBreakpointTests.java
@@ -75,7 +75,7 @@
assertNotNull("suspended, but not by breakpoint", hit);
assertEquals("suspended, but not by exception breakpoint", ex ,hit);
IJavaStackFrame frame= (IJavaStackFrame)thread.getTopStackFrame();
- assertTrue("Should have been suspended at line number 38, not " + frame.getLineNumber(), frame.getLineNumber() == 38);
+ assertEquals("Should have been suspended at line number 38, not " + frame.getLineNumber(), 38, frame.getLineNumber());
ex.delete();
} finally {
terminateAndRemove(thread);
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/HitCountBreakpointsTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/HitCountBreakpointsTests.java
index 313ad10..4ef0936 100755
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/HitCountBreakpointsTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/HitCountBreakpointsTests.java
@@ -53,18 +53,18 @@
IJavaPrimitiveValue value = (IJavaPrimitiveValue)var.getValue();
assertNotNull("variable 'i' has no value", value);
int iValue = value.getIntValue();
- assertTrue("value of 'i' should be '2', but was " + iValue, iValue == 2);
+ assertEquals("value of 'i' should be '2', but was " + iValue, 2, iValue);
bp.setHitCount(2);
IJavaThread thread2 = resumeToLineBreakpoint(thread, bp);
- assertTrue("second suspended thread not the same as first", thread == thread2);
+ assertSame("second suspended thread not the same as first", thread, thread2);
frame = (IJavaStackFrame)thread2.getTopStackFrame();
var = findVariable(frame, "i");
value = (IJavaPrimitiveValue)var.getValue();
assertNotNull("variable 'i' has no value", value);
iValue = value.getIntValue();
- assertTrue("value of 'i' should be '4', but was " + iValue, iValue == 4);
+ assertEquals("value of 'i' should be '4', but was " + iValue, 4, iValue);
resumeAndExit(thread2);
@@ -96,7 +96,7 @@
IJavaPrimitiveValue value = (IJavaPrimitiveValue)var.getValue();
assertNotNull("variable 'i' has no value", value);
int iValue = value.getIntValue();
- assertTrue("value of 'i' should be '2', but was " + iValue, iValue == 2);
+ assertEquals("value of 'i' should be '2', but was " + iValue, 2, iValue);
resumeAndExit(thread);
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/ImportBreakpointsTest.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/ImportBreakpointsTest.java
index 6b8470b..51a44d2 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/ImportBreakpointsTest.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/ImportBreakpointsTest.java
@@ -59,7 +59,7 @@
breakpoints.add(createLineBreakpoint(24, typeName));
breakpoints.add(createExceptionBreakpoint("Exception", true, false));
breakpoints.add(createMethodBreakpoint(typeName, "method4", "()V", true, false));
- assertEquals("manager does not contain 6 breakpoints for exporting", getBreakpointManager().getBreakpoints().length, 6);
+ assertEquals("manager does not contain 6 breakpoints for exporting", 6, getBreakpointManager().getBreakpoints().length);
Path path = new Path("exbkptA.bkpt");
assertNotNull("Invalid path", path);
ExportBreakpointsOperation op = new ExportBreakpointsOperation(breakpoints.toArray(new IBreakpoint[breakpoints.size()]), path.toOSString());
@@ -99,7 +99,7 @@
breakpoints.add(createLineBreakpoint(24, typeName));
breakpoints.add(createExceptionBreakpoint("Exception", true, false));
breakpoints.add(createMethodBreakpoint(typeName, "method4", "()V", true, false));
- assertEquals("manager does not contain 6 breakpoints for exporting", getBreakpointManager().getBreakpoints().length, 6);
+ assertEquals("manager does not contain 6 breakpoints for exporting", 6, getBreakpointManager().getBreakpoints().length);
ExportBreakpointsOperation op = new ExportBreakpointsOperation(breakpoints.toArray(new IBreakpoint[breakpoints.size()]));
op.run(new NullProgressMonitor());
StringBuffer buffer = op.getBuffer();
@@ -128,7 +128,7 @@
breakpoints.add(createLineBreakpoint(24, typeName));
breakpoints.add(createExceptionBreakpoint("Exception", true, false));
breakpoints.add(createMethodBreakpoint(typeName, "method4", "()V", true, false));
- assertEquals("manager does not contain 6 breakpoints for exporting", getBreakpointManager().getBreakpoints().length, 6);
+ assertEquals("manager does not contain 6 breakpoints for exporting", 6, getBreakpointManager().getBreakpoints().length);
Path path = new Path("exbkptB.bkpt");
assertNotNull("Invalid path", path);
ExportBreakpointsOperation op = new ExportBreakpointsOperation(breakpoints.toArray(new IBreakpoint[breakpoints.size()]), path.toOSString());
@@ -160,7 +160,7 @@
assertEquals("should be no breakpoints", 0, getBreakpointManager().getBreakpoints().length);
return;
}
- assertTrue("Import should have failed with exception", false);
+ fail("Import should have failed with exception");
}
finally {
removeAllBreakpoints();
@@ -190,7 +190,7 @@
bporg.addBreakpoint(createExceptionBreakpoint("Exception", true, false), category);
bporg.addBreakpoint(createMethodBreakpoint(typeName, "method4", "()V", true, false), category);
assertEquals("workingset does not have 6 elements", 6, set.getElements().length);
- assertEquals("manager does not have 6 breakpoints", getBreakpointManager().getBreakpoints().length, 6);
+ assertEquals("manager does not have 6 breakpoints", 6, getBreakpointManager().getBreakpoints().length);
Path path = new Path("exbkptC.bkpt");
assertNotNull("Invalid path", path);
ExportBreakpointsOperation op = new ExportBreakpointsOperation(getBreakpointManager().getBreakpoints(), path.toOSString());
@@ -262,7 +262,7 @@
bporg.addBreakpoint(createExceptionBreakpoint("Exception", true, false), category);
bporg.addBreakpoint(createMethodBreakpoint(typeName, "method4", "()V", true, false), category);
assertEquals("workingset does not have 6 elements", 6, set.getElements().length);
- assertEquals("manager does not have 6 breakpoints", getBreakpointManager().getBreakpoints().length, 6);
+ assertEquals("manager does not have 6 breakpoints", 6, getBreakpointManager().getBreakpoints().length);
Path path = new Path("exbkptC.bkpt");
assertNotNull("Invalid path", path);
ExportBreakpointsOperation op = new ExportBreakpointsOperation(getBreakpointManager().getBreakpoints(), path.toOSString());
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/JavaBreakpointListenerTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/JavaBreakpointListenerTests.java
index b39bbe3..78003e1 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/JavaBreakpointListenerTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/JavaBreakpointListenerTests.java
@@ -798,7 +798,7 @@
IVariable variable = variables[i];
if (variable.getName().equals("value")) {
IValue iValue = variable.getValue();
- assertTrue("Should be an int", iValue.getReferenceTypeName().equals("int"));
+ assertEquals("Should be an int", "int", iValue.getReferenceTypeName());
assertTrue("Should be a primitive", iValue instanceof IJavaPrimitiveValue);
int intValue = ((IJavaPrimitiveValue)iValue).getIntValue();
assertEquals("Wrong value", 0, intValue);
@@ -876,7 +876,7 @@
IVariable variable = variables[i];
if (variable.getName().equals("value")) {
IValue iValue = variable.getValue();
- assertTrue("Should be an int", iValue.getReferenceTypeName().equals("int"));
+ assertEquals("Should be an int", "int", iValue.getReferenceTypeName());
assertTrue("Should be a primitive", iValue instanceof IJavaPrimitiveValue);
int intValue = ((IJavaPrimitiveValue)iValue).getIntValue();
assertEquals("Wrong value", 0, intValue);
@@ -931,7 +931,7 @@
IVariable variable = variables[i];
if (variable.getName().equals("value")) {
IValue iValue = variable.getValue();
- assertTrue("Should be an int", iValue.getReferenceTypeName().equals("int"));
+ assertEquals("Should be an int", "int", iValue.getReferenceTypeName());
assertTrue("Should be a primitive", iValue instanceof IJavaPrimitiveValue);
int intValue = ((IJavaPrimitiveValue)iValue).getIntValue();
assertEquals("Wrong value", 0, intValue);
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/MethodBreakpointTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/MethodBreakpointTests.java
index eaa7f8c..b99e437 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/MethodBreakpointTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/MethodBreakpointTests.java
@@ -226,7 +226,7 @@
IJavaPrimitiveValue value = (IJavaPrimitiveValue)var.getValue();
assertNotNull("variable 'sum' has no value", value);
int iValue = value.getIntValue();
- assertTrue("value of 'sum' should be '3', but was " + iValue, iValue == 3);
+ assertEquals("value of 'sum' should be '3', but was " + iValue, 3, iValue);
bp.delete();
} finally {
@@ -256,7 +256,7 @@
IJavaPrimitiveValue value = (IJavaPrimitiveValue)var.getValue();
assertNotNull("variable 'sum' has no value", value);
int iValue = value.getIntValue();
- assertTrue("value of 'sum' should be '6', but was " + iValue, iValue == 6);
+ assertEquals("value of 'sum' should be '6', but was " + iValue, 6, iValue);
bp.delete();
} finally {
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/MiscBreakpointsTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/MiscBreakpointsTests.java
index 55a98ba..6949947 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/MiscBreakpointsTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/MiscBreakpointsTests.java
@@ -54,7 +54,7 @@
javaThread= launchAndSuspend(typeName);
int stackLine = javaThread.getTopStackFrame().getLineNumber();
- assertTrue("line number should be '29', but was " + stackLine, stackLine == 29);
+ assertEquals("line number should be '29', but was " + stackLine, 29, stackLine);
} finally {
getPrefStore().setValue(IJDIPreferencesConstants.PREF_SUSPEND_ON_UNCAUGHT_EXCEPTIONS, false);
@@ -82,7 +82,7 @@
javaThread= launchAndSuspend(typeName);
int stackLine = javaThread.getTopStackFrame().getLineNumber();
- assertTrue("line number should be '3', but was " + stackLine, stackLine == 3);
+ assertEquals("line number should be '3', but was " + stackLine, 3, stackLine);
} finally {
getPrefStore().setValue(IJDIPreferencesConstants.PREF_SUSPEND_ON_UNCAUGHT_EXCEPTIONS, false);
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/SpecialExceptionBreakpointTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/SpecialExceptionBreakpointTests.java
index dfdcc5a..7f73457 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/SpecialExceptionBreakpointTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/SpecialExceptionBreakpointTests.java
@@ -169,9 +169,7 @@
private void assertExceptionBreakpointHit(IJavaThread thread, IJavaExceptionBreakpoint ex) throws DebugException {
IMarker problem = JavaDebugOptionsManager.getDefault().getProblem((IJavaStackFrame) thread.getTopStackFrame());
- if (problem != null) {
- fail("unexpected problem marker "+problem);
- }
+ assertNull("unexpected problem marker " + problem, problem);
IBreakpoint hit = getBreakpoint(thread);
assertNotNull("suspended, but not by breakpoint", hit);
assertEquals("suspended, but not by expected exception", ex.getExceptionTypeName(), ((IJavaExceptionBreakpoint) hit).getExceptionTypeName());
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/SuspendVMBreakpointsTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/SuspendVMBreakpointsTests.java
index baaecf4..a1fac20 100755
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/SuspendVMBreakpointsTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/SuspendVMBreakpointsTests.java
@@ -138,7 +138,7 @@
assertNotNull("No breakpoint", hit);
// should be modification
- assertTrue("First hit should be modification", !wp.isAccessSuspend(thread.getDebugTarget()));
+ assertFalse("First hit should be modification", wp.isAccessSuspend(thread.getDebugTarget()));
// line 27
assertEquals("Should be on line 30", 30, frame.getLineNumber());
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/TargetPatternBreakpointTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/TargetPatternBreakpointTests.java
index dcef86a..c28ef53 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/TargetPatternBreakpointTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/TargetPatternBreakpointTests.java
@@ -130,7 +130,7 @@
try {
bp.setPattern(target,"Breakp");
} catch (CoreException e) {
- assertTrue("Failed to set pattern", false);
+ fail("Failed to set pattern");
}
}
}
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/ThreadFilterBreakpointsTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/ThreadFilterBreakpointsTests.java
index e8018c3..93e7211 100755
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/ThreadFilterBreakpointsTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/ThreadFilterBreakpointsTests.java
@@ -70,7 +70,7 @@
bp2.setThreadFilter(thread);
thread = resumeToLineBreakpoint(thread, bp2);
- assertTrue("Suspended thread should have been '1stThread'", thread.getName().equals("1stThread"));
+ assertEquals("Suspended thread should have been '1stThread'", "1stThread", thread.getName());
bp1.delete();
bp2.delete();
@@ -82,6 +82,7 @@
/**
* Tests that a thread works for specific exception breakpoint
+ *
* @throws Exception
*/
public void testExceptionThreadFilterBreakpoint() throws Exception {
@@ -95,7 +96,7 @@
ex1.setThreadFilter(thread);
thread = resume(thread);
- assertTrue("Suspended thread should have been '1stThread'", thread.getName().equals("1stThread"));
+ assertEquals("Suspended thread should have been '1stThread'", "1stThread", thread.getName());
bp1.delete();
} finally {
@@ -119,7 +120,7 @@
wp.setThreadFilter(thread);
thread = resume(thread);
- assertTrue("Suspended thread should have been '1stThread'", thread.getName().equals("1stThread"));
+ assertEquals("Suspended thread should have been '1stThread'", "1stThread", thread.getName());
bp1.delete();
wp.delete();
@@ -144,7 +145,7 @@
wp.setThreadFilter(thread);
thread = resume(thread);
- assertTrue("Suspended thread should have been '1stThread'", thread.getName().equals("1stThread"));
+ assertEquals("Suspended thread should have been '1stThread'", "1stThread", thread.getName());
bp1.delete();
wp.delete();
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/TriggerPointBreakpointsTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/TriggerPointBreakpointsTests.java
index 3dda63a..7d2dd67 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/TriggerPointBreakpointsTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/TriggerPointBreakpointsTests.java
@@ -55,7 +55,7 @@
IJavaPrimitiveValue value = (IJavaPrimitiveValue)var.getValue();
assertNotNull("variable 'i' has no value", value);
int iValue = value.getIntValue();
- assertTrue("value of 'i' should be '1', but was " + iValue, iValue == 1);
+ assertEquals("value of 'i' should be '1', but was " + iValue, 1, iValue);
var = findVariable(frame, "j");
assertNotNull("Could not find variable 'j'", var);
@@ -63,7 +63,7 @@
value = (IJavaPrimitiveValue) var.getValue();
assertNotNull("variable 'j' has no value", value);
int jValue = value.getIntValue();
- assertTrue("value of 'j' should be '1', but was " + jValue, jValue == 1);
+ assertEquals("value of 'j' should be '1', but was " + jValue, 1, jValue);
bp1.delete();
bp2.delete();
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/TypeNameBreakpointTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/TypeNameBreakpointTests.java
index c45a187..bbb5c0f 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/TypeNameBreakpointTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/TypeNameBreakpointTests.java
@@ -561,7 +561,7 @@
try {
JDIDebugModel.addJavaBreakpointListener(l);
thread = launchToBreakpoint(getLaunchConfiguration("HitCountLooper"));
- assertEquals(l.getBreakpointTypeName(), "HitCountLooper");
+ assertEquals("HitCountLooper", l.getBreakpointTypeName());
} finally {
terminateAndRemove(thread);
removeAllBreakpoints();
@@ -577,7 +577,7 @@
try {
JDIDebugModel.addJavaBreakpointListener(l);
thread = launchToBreakpoint(getLaunchConfiguration("HitCountLooper"));
- assertEquals(l.getBreakpointTypeName(), "HitCountLooper");
+ assertEquals("HitCountLooper", l.getBreakpointTypeName());
} finally {
terminateAndRemove(thread);
removeAllBreakpoints();
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/WatchpointTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/WatchpointTests.java
index ceb3ff3..f26cb21 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/WatchpointTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/WatchpointTests.java
@@ -57,7 +57,7 @@
assertNotNull("No breakpoint", hit);
// should be modification
- assertTrue("First hit should be modification", !wp.isAccessSuspend(thread.getDebugTarget()));
+ assertFalse("First hit should be modification", wp.isAccessSuspend(thread.getDebugTarget()));
// line 30
assertEquals("Should be on line 30", 30, frame.getLineNumber());
@@ -104,7 +104,7 @@
assertNotNull("No breakpoint", hit);
// should be modification
- assertTrue("First hit should be modification", !wp.isAccessSuspend(thread.getDebugTarget()));
+ assertFalse("First hit should be modification", wp.isAccessSuspend(thread.getDebugTarget()));
// line 30
assertEquals("Should be on line 30", 30, frame.getLineNumber());
@@ -240,7 +240,7 @@
IJavaPrimitiveValue value = (IJavaPrimitiveValue)var.getValue();
assertNotNull(value);
int varValue = value.getIntValue();
- assertTrue("'value' should be 7", varValue == 7);
+ assertEquals("'value' should be 7", 7, varValue);
wp.setHitCount(0);
@@ -287,7 +287,7 @@
assertNotNull("No breakpoint", hit);
// should be modification
- assertTrue("First hit should be modification", !wp.isAccessSuspend(thread.getDebugTarget()));
+ assertFalse("First hit should be modification", wp.isAccessSuspend(thread.getDebugTarget()));
// line 27
assertEquals("Should be on line 30", 30, frame.getLineNumber());
@@ -321,7 +321,7 @@
assertNotNull("No watchpoint", hit);
// should be modification
- assertTrue("First hit should be modification", !wp.isAccessSuspend(thread.getDebugTarget()));
+ assertFalse("First hit should be modification", wp.isAccessSuspend(thread.getDebugTarget()));
// line 27
assertEquals("Should be on line 18", 18, frame.getLineNumber());
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/ArgumentTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/ArgumentTests.java
index 50a9967..121a6e5 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/ArgumentTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/ArgumentTests.java
@@ -392,7 +392,7 @@
}
assertNotNull(commandLine);
if (!fUseArgfile) {
- assertTrue("command line must not contain an @argfile", commandLine.indexOf(" @") == -1);
+ assertEquals("command line must not contain an @argfile", -1, commandLine.indexOf(" @"));
} else {
assertTrue("command line must contain an @argfile", commandLine.indexOf(" @") > -1);
}
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/ArrayTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/ArrayTests.java
index 3766f9b..d2012f3 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/ArrayTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/ArrayTests.java
@@ -13,6 +13,8 @@
*******************************************************************************/
package org.eclipse.jdt.debug.tests.core;
+import static org.junit.Assert.assertNotEquals;
+
import org.eclipse.debug.core.model.ILineBreakpoint;
import org.eclipse.debug.core.model.IVariable;
import org.eclipse.jdt.debug.core.IJavaArray;
@@ -125,9 +127,9 @@
for (int i = 0; i < values.length; i++) {
byte byteValue = ((IJavaPrimitiveValue)values[i]).getByteValue();
if (i < 2500) {
- assertFalse((byte)-1 == byteValue);
+ assertNotEquals((byte) -1, byteValue);
} else if (i >= 7500) {
- assertFalse((byte)-1 == byteValue);
+ assertNotEquals((byte) -1, byteValue);
} else {
assertEquals((byte)-1, byteValue);
}
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/ConsoleTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/ConsoleTests.java
index 0c058bd..61ab1f9 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/ConsoleTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/ConsoleTests.java
@@ -123,8 +123,8 @@
IConsoleManager consoleManager = ConsolePlugin.getDefault().getConsoleManager();
consoleManager.addConsoles(new IConsole[]{console});
consoleManager.removeConsoles(new IConsole[]{console});
- assertTrue("Console was initialized", !console.fInit);
- assertTrue("Console was disposed", !console.fDispose);
+ assertFalse("Console was initialized", console.fInit);
+ assertFalse("Console was disposed", console.fDispose);
console.dispose();
}
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/EEDefinitionTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/EEDefinitionTests.java
index 9af53b2..5acfcce 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/EEDefinitionTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/EEDefinitionTests.java
@@ -74,7 +74,7 @@
assertNotNull("Missing EE file", file);
assertNotNull("Missing EE VM type", vmType);
IStatus status = vmType.validateInstallLocation(file);
- assertTrue("Invalid install location", status.getSeverity() == IStatus.INFO);
+ assertEquals("Invalid install location", IStatus.INFO, status.getSeverity());
}
/**
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/EventSetTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/EventSetTests.java
index 6e57c5b..8202b68 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/EventSetTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/EventSetTests.java
@@ -47,7 +47,7 @@
DebugEvent[] set = getEventSet();
assertTrue("Should be two events", set!= null && set.length == 2);
for (int i = 0; i < set.length; i++) {
- assertTrue("should be a breakpoint event", set[i].getDetail() == DebugEvent.BREAKPOINT);
+ assertEquals("should be a breakpoint event", DebugEvent.BREAKPOINT, set[i].getDetail());
}
IBreakpoint[] hits = thread.getBreakpoints();
assertTrue("should be two breakpoints", hits != null && hits.length == 2);
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/ExecutionEnvironmentTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/ExecutionEnvironmentTests.java
index fd21b4c..5b61fda 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/ExecutionEnvironmentTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/ExecutionEnvironmentTests.java
@@ -48,7 +48,7 @@
return;
}
}
- assertTrue("Did not find environment J2SE-1.4", false);
+ fail("Did not find environment J2SE-1.4");
}
public void testAnalyze() throws Exception {
@@ -65,7 +65,7 @@
return;
}
}
- assertTrue("vm should be J2SE-1.4 compliant", false);
+ fail("vm should be J2SE-1.4 compliant");
}
private int compareJavaVersions(IVMInstall vm, String ver) {
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/InstanceVariableTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/InstanceVariableTests.java
index 8229ed0..91afab2 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/InstanceVariableTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/InstanceVariableTests.java
@@ -51,17 +51,17 @@
assertNotNull(value);
IJavaVariable pubStr = value.getField("pubStr", false);
assertNotNull(pubStr);
- assertEquals("value should be 'redefined public'", pubStr.getValue().getValueString(), "redefined public");
+ assertEquals("value should be 'redefined public'", "redefined public", pubStr.getValue().getValueString());
// retrieve an instance var in superclass
IJavaVariable privStr = value.getField("privStr", false);
assertNotNull(privStr);
- assertEquals("value should be 'private'", privStr.getValue().getValueString(), "private");
+ assertEquals("value should be 'private'", "private", privStr.getValue().getValueString());
// retrieve an instance var in super class with same name
pubStr = value.getField("pubStr", true);
assertNotNull(pubStr);
- assertEquals("value should be 'public'", pubStr.getValue().getValueString(), "public");
+ assertEquals("value should be 'public'", "public", pubStr.getValue().getValueString());
} finally {
terminateAndRemove(thread);
removeAllBreakpoints();
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/LineTrackerTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/LineTrackerTests.java
index 9528825..ea71e0f 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/LineTrackerTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/LineTrackerTests.java
@@ -229,7 +229,7 @@
}
}
}
- assertTrue("NPE breakpoint should not exist yet", foundBreakpoint == null);
+ assertNull("NPE breakpoint should not exist yet", foundBreakpoint);
IJavaExceptionBreakpoint ex = createExceptionBreakpoint("java.lang.NullPointerException", true, false);
ex.setEnabled(false);
JavaExceptionHyperLink exLink = (JavaExceptionHyperLink) hyperlinks[0];
@@ -246,9 +246,9 @@
}
}
}
- assertTrue("NPE breakpoint not found", foundBreakpoint != null);
+ assertNotNull("NPE breakpoint not found", foundBreakpoint);
assertTrue("NPE breakpoint not enabled", foundBreakpoint.isEnabled());
- assertTrue("NPE breakpoint cancel enablement value not false", foundBreakpoint.getMarker().getAttribute(JavaBreakpointPage.ATTR_ENABLED_SETTING_ON_CANCEL, "").equals("false"));
+ assertEquals("NPE breakpoint cancel enablement value not false", "false", foundBreakpoint.getMarker().getAttribute(JavaBreakpointPage.ATTR_ENABLED_SETTING_ON_CANCEL, ""));
} finally {
ConsoleLineTracker.setDelegate(null);
jdiUIPreferences.setValue(IJDIPreferencesConstants.PREF_SUSPEND_ON_UNCAUGHT_EXCEPTIONS, suspendOnException);
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/LiteralTests17.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/LiteralTests17.java
index f691a9c..8faac04 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/LiteralTests17.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/LiteralTests17.java
@@ -58,7 +58,7 @@
thread = launchToLineBreakpoint(LITERAL_TYPE_NAME, bp);
IEvaluationResult result = evaluate(snippet, thread);
assertNotNull("There must be an evaluation result", result);
- assertTrue("There must be no errors in the result", !result.hasErrors());
+ assertFalse("There must be no errors in the result", result.hasErrors());
return result.getValue();
}
finally {
@@ -84,10 +84,10 @@
thread = launchToLineBreakpoint(LITERAL_TYPE_NAME, bp);
IEvaluationResult result = evaluate(snippet, thread);
assertNotNull("There must be an evaluation result", result);
- assertTrue("There must be no errors in the result", !result.hasErrors());
+ assertFalse("There must be no errors in the result", result.hasErrors());
result = evaluate(snippet2, thread);
assertNotNull("There must be an evaluation result", result);
- assertTrue("There must be no errors in the result", !result.hasErrors());
+ assertFalse("There must be no errors in the result", result.hasErrors());
return result.getValue();
}
finally {
@@ -106,7 +106,7 @@
assertNotNull("The value should not be null", value);
assertTrue("The underlying value must be a primitive value", value instanceof JDIPrimitiveValue);
JDIPrimitiveValue val = (JDIPrimitiveValue) value;
- assertTrue("The new integer value should be 11", val.getIntValue() == 11);
+ assertEquals("The new integer value should be 11", 11, val.getIntValue());
}
/**
@@ -119,7 +119,7 @@
assertNotNull("The value should not be null", value);
assertTrue("The underlying value must be a primitive value", value instanceof JDIPrimitiveValue);
JDIPrimitiveValue val = (JDIPrimitiveValue) value;
- assertTrue("The new integer value should be 12", val.getIntValue() == 12);
+ assertEquals("The new integer value should be 12", 12, val.getIntValue());
}
/**
@@ -132,7 +132,7 @@
assertNotNull("The value should not be null", value);
assertTrue("The underlying value must be a primitive value", value instanceof JDIPrimitiveValue);
JDIPrimitiveValue val = (JDIPrimitiveValue) value;
- assertTrue("The new short value should be 11", val.getShortValue() == 11);
+ assertEquals("The new short value should be 11", 11, val.getShortValue());
}
/**
@@ -145,7 +145,7 @@
assertNotNull("The value should not be null", value);
assertTrue("The underlying value must be a primitive value", value instanceof JDIPrimitiveValue);
JDIPrimitiveValue val = (JDIPrimitiveValue) value;
- assertTrue("The new short value should be 12", val.getShortValue() == 12);
+ assertEquals("The new short value should be 12", 12, val.getShortValue());
}
/**
@@ -158,7 +158,7 @@
assertNotNull("The value should not be null", value);
assertTrue("The underlying value must be a primitive value", value instanceof JDIPrimitiveValue);
JDIPrimitiveValue val = (JDIPrimitiveValue) value;
- assertTrue("The new byte value should be 9", val.getByteValue() == 9);
+ assertEquals("The new byte value should be 9", 9, val.getByteValue());
}
/**
@@ -171,7 +171,7 @@
assertNotNull("The value should not be null", value);
assertTrue("The underlying value must be a primitive value", value instanceof JDIPrimitiveValue);
JDIPrimitiveValue val = (JDIPrimitiveValue) value;
- assertTrue("The new byte value should be 12", val.getByteValue() == 12);
+ assertEquals("The new byte value should be 12", 12, val.getByteValue());
}
/**
@@ -184,7 +184,7 @@
assertNotNull("The value should not be null", value);
assertTrue("The underlying value must be a primitive value", value instanceof JDIPrimitiveValue);
JDIPrimitiveValue val = (JDIPrimitiveValue) value;
- assertTrue("The new long value should be 11", val.getLongValue() == 11);
+ assertEquals("The new long value should be 11", 11, val.getLongValue());
}
/**
@@ -197,7 +197,7 @@
assertNotNull("The value should not be null", value);
assertTrue("The underlying value must be a primitive value", value instanceof JDIPrimitiveValue);
JDIPrimitiveValue val = (JDIPrimitiveValue) value;
- assertTrue("The new long value should be 12", val.getLongValue() == 12);
+ assertEquals("The new long value should be 12", 12, val.getLongValue());
}
/**
@@ -210,7 +210,7 @@
assertNotNull("The value should not be null", value);
assertTrue("The underlying value must be a primitive value", value instanceof JDIPrimitiveValue);
JDIPrimitiveValue val = (JDIPrimitiveValue) value;
- assertTrue("The new float value should be 4.1415", val.getFloatValue() == 4.1415F);
+ assertEquals("The new float value should be 4.1415", 4.1415F, val.getFloatValue(), .0F);
}
/**
@@ -223,7 +223,7 @@
assertNotNull("The value should not be null", value);
assertTrue("The underlying value must be a primitive value", value instanceof JDIPrimitiveValue);
JDIPrimitiveValue val = (JDIPrimitiveValue) value;
- assertTrue("The new float value should be 7.1415", val.getFloatValue() == 7.1415F);
+ assertEquals("The new float value should be 7.1415", 7.1415F, val.getFloatValue(), .0F);
}
/**
@@ -236,7 +236,7 @@
assertNotNull("The value should not be null", value);
assertTrue("The underlying value must be a primitive value", value instanceof JDIPrimitiveValue);
JDIPrimitiveValue val = (JDIPrimitiveValue) value;
- assertTrue("The new double value should be 11.556", val.getDoubleValue() == 11.556D);
+ assertEquals("The new double value should be 11.556", 11.556D, val.getDoubleValue(), .0);
}
/**
@@ -249,7 +249,7 @@
assertNotNull("The value should not be null", value);
assertTrue("The underlying value must be a primitive value", value instanceof JDIPrimitiveValue);
JDIPrimitiveValue val = (JDIPrimitiveValue) value;
- assertTrue("The new double value should be 16.556", val.getDoubleValue() == 16.555999999999997D);
+ assertEquals("The new double value should be 16.556", 16.555999999999997D, val.getDoubleValue(), .0);
}
/**
@@ -262,7 +262,7 @@
assertNotNull("The value should not be null", value);
assertTrue("The underlying value must be a primitive value", value instanceof JDIPrimitiveValue);
JDIPrimitiveValue val = (JDIPrimitiveValue) value;
- assertTrue("The new integer value should be 9", val.getIntValue() == 9);
+ assertEquals("The new integer value should be 9", 9, val.getIntValue());
}
/**
@@ -275,7 +275,7 @@
assertNotNull("The value should not be null", value);
assertTrue("The underlying value must be a primitive value", value instanceof JDIPrimitiveValue);
JDIPrimitiveValue val = (JDIPrimitiveValue) value;
- assertTrue("The new integer value should be 17", val.getIntValue() == 17);
+ assertEquals("The new integer value should be 17", 17, val.getIntValue());
}
/**
@@ -288,7 +288,7 @@
assertNotNull("The value should not be null", value);
assertTrue("The underlying value must be a primitive value", value instanceof JDIPrimitiveValue);
JDIPrimitiveValue val = (JDIPrimitiveValue) value;
- assertTrue("The new integer value should be 17", val.getIntValue() == 17);
+ assertEquals("The new integer value should be 17", 17, val.getIntValue());
}
/**
@@ -301,7 +301,7 @@
assertNotNull("The value should not be null", value);
assertTrue("The underlying value must be a primitive value", value instanceof JDIPrimitiveValue);
JDIPrimitiveValue val = (JDIPrimitiveValue) value;
- assertTrue("The new integer value should be 257", val.getIntValue() == 257);
+ assertEquals("The new integer value should be 257", 257, val.getIntValue());
}
/**
@@ -314,7 +314,7 @@
assertNotNull("The value should not be null", value);
assertTrue("The underlying value must be a primitive value", value instanceof JDIPrimitiveValue);
JDIPrimitiveValue val = (JDIPrimitiveValue) value;
- assertTrue("The new integer value should be 9", val.getIntValue() == 9);
+ assertEquals("The new integer value should be 9", 9, val.getIntValue());
}
/**
@@ -327,6 +327,6 @@
assertNotNull("The value should not be null", value);
assertTrue("The underlying value must be a primitive value", value instanceof JDIPrimitiveValue);
JDIPrimitiveValue val = (JDIPrimitiveValue) value;
- assertTrue("The new integer value should be 65", val.getIntValue() == 65);
+ assertEquals("The new integer value should be 65", 65, val.getIntValue());
}
}
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/LocalVariableTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/LocalVariableTests.java
index e2b4fce..88ec7eb 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/LocalVariableTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/LocalVariableTests.java
@@ -55,7 +55,7 @@
IValue value = var.getValue();
assertTrue("The value should be an array", value instanceof JDIArrayValue);
JDIArrayValue aval = (JDIArrayValue) value;
- assertTrue("there should be two values in the array", aval.getSize() == 2);
+ assertEquals("there should be two values in the array", 2, aval.getSize());
assertEquals("The array kind should be integer", "int[]", aval.getReferenceTypeName());
} finally {
terminateAndRemove(thread);
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/ModuleOptionsTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/ModuleOptionsTests.java
index 5387431..95d0c2c 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/ModuleOptionsTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/ModuleOptionsTests.java
@@ -220,9 +220,8 @@
fail("Unknown set of default modules " + String.join(",", defaultModules));
return;
}
- if (!defaultModules.remove("jdk.javadoc")) { // requires java.compiler and jdk.compiler but is required by no default module
- fail("expected module was not in defaultModules");
- }
+ assertTrue("expected module was not in defaultModules", defaultModules.remove("jdk.javadoc")); // requires java.compiler and jdk.compiler but
+ // is required by no default module
try {
IClasspathAttribute[] attributes = {
JavaCore.newClasspathAttribute(IClasspathAttribute.LIMIT_MODULES, String.join(",", defaultModules)) };
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/ProcessTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/ProcessTests.java
index 229a6ca..b5e21cf 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/ProcessTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/ProcessTests.java
@@ -51,7 +51,7 @@
assertEquals("Exit value not normal", 0, exitValue);
return;
}
- assertTrue("Should not be able to get exit value - process not terminated", false);
+ fail("Should not be able to get exit value - process not terminated");
} finally {
terminateAndRemove(thread);
removeAllBreakpoints();
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/RemoteJavaApplicationTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/RemoteJavaApplicationTests.java
index 70b05ba..a7eb006 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/RemoteJavaApplicationTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/RemoteJavaApplicationTests.java
@@ -116,7 +116,7 @@
ILineBreakpoint breakpoint= (ILineBreakpoint) hit;
int lineNumber = breakpoint.getLineNumber();
int stackLine = thread.getTopStackFrame().getLineNumber();
- assertTrue("line numbers of breakpoint and stack frame do not match", lineNumber == stackLine);
+ assertEquals("line numbers of breakpoint and stack frame do not match", lineNumber, stackLine);
breakpoint.delete();
} finally {
terminateAndRemove(thread);
@@ -224,7 +224,7 @@
ILineBreakpoint breakpoint= (ILineBreakpoint) hit;
int lineNumber = breakpoint.getLineNumber();
int stackLine = thread.getTopStackFrame().getLineNumber();
- assertTrue("line numbers of breakpoint and stack frame do not match", lineNumber == stackLine);
+ assertEquals("line numbers of breakpoint and stack frame do not match", lineNumber, stackLine);
breakpoint.delete();
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/StringSubstitutionTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/StringSubstitutionTests.java
index b044be6..fc8fcc1 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/StringSubstitutionTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/StringSubstitutionTests.java
@@ -310,7 +310,7 @@
String expression = "something ${var_A} else";
try {
doSubs(expression);
- assertTrue("Expected cycle to cause exception", false);
+ fail("Expected cycle to cause exception");
} catch (CoreException ce){
IStatus status = ce.getStatus();
if (status.getSeverity() != IStatus.ERROR || status.getCode() != VariablesPlugin.REFERENCE_CYCLE_ERROR) {
@@ -337,7 +337,7 @@
String expression = "something ${var_A} else";
try {
doSubs(expression);
- assertTrue("Expected cycle to cause exception", false);
+ fail("Expected cycle to cause exception");
} catch (CoreException ce){
IStatus status = ce.getStatus();
if (status.getSeverity() != IStatus.ERROR || status.getCode() != VariablesPlugin.REFERENCE_CYCLE_ERROR) {
@@ -370,7 +370,7 @@
String expression = "${var_A}${var_B}";
try {
doSubs(expression);
- assertTrue("Expected cycle to cause exception", false);
+ fail("Expected cycle to cause exception");
} catch (CoreException ce){
IStatus status = ce.getStatus();
if (status.getSeverity() != IStatus.ERROR || status.getCode() != VariablesPlugin.REFERENCE_CYCLE_ERROR) {
@@ -848,6 +848,6 @@
// should cause an exception when no selection
return;
}
- assertFalse("Empty selection should throw an exception", true);
+ fail("Empty selection should throw an exception");
}
}
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/TypeTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/TypeTests.java
index d6a399c..e890662 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/TypeTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/TypeTests.java
@@ -70,7 +70,7 @@
index++;
int stackLine = frame.getLineNumber();
- assertTrue("line numbers of breakpoint and stack frame do not match", lineNumber == stackLine);
+ assertEquals("line numbers of breakpoint and stack frame do not match", lineNumber, stackLine);
bps.remove(breakpoint);
breakpoint.delete();
if (!bps.isEmpty()) {
@@ -113,7 +113,7 @@
index++;
int stackLine = frame.getLineNumber();
- assertTrue("line numbers of breakpoint and stack frame do not match", lineNumber == stackLine);
+ assertEquals("line numbers of breakpoint and stack frame do not match", lineNumber, stackLine);
bps.remove(breakpoint);
breakpoint.delete();
if (!bps.isEmpty()) {
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/VMInstallTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/VMInstallTests.java
index 854b343..10108e0 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/VMInstallTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/VMInstallTests.java
@@ -17,13 +17,13 @@
import java.net.URL;
import java.util.Map;
-import org.eclipse.jdt.debug.testplugin.JavaTestPlugin;
-import org.eclipse.jdt.debug.tests.AbstractDebugTest;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
+import org.eclipse.jdt.debug.testplugin.JavaTestPlugin;
+import org.eclipse.jdt.debug.tests.AbstractDebugTest;
import org.eclipse.jdt.internal.launching.LaunchingPlugin;
import org.eclipse.jdt.launching.ILibraryLocationResolver;
import org.eclipse.jdt.launching.IVMInstall;
@@ -221,7 +221,7 @@
assertTrue("There should be a source path ending in test_resolver_src.zip on the ext lib [" + locpath + "]",
locs[i].getSystemLibrarySourcePath().toString().indexOf("test_resolver_src.zip") > -1);
IPath root = locs[i].getPackageRootPath();
- assertTrue("The source root path should be 'src' for ext lib ["+locpath+"]", root.toString().equals("src"));
+ assertEquals("The source root path should be 'src' for ext lib [" + locpath + "]", "src", root.toString());
URL url = locs[i].getJavadocLocation();
assertNotNull("There should be a Javadoc URL set for ext lib ["+locpath+"]", url);
assertTrue("There should be a javadoc path of test_resolver_javadoc.zip on the ext lib ["+locpath+"]",
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/eval/SyntheticVariableTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/eval/SyntheticVariableTests.java
index 6ade9af..b7d3b05 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/eval/SyntheticVariableTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/eval/SyntheticVariableTests.java
@@ -111,7 +111,7 @@
List<ICompletionProposal> proposals = computeCompletionProposals(" ", 0);
assertNotNull("proposals are null : ", proposals);
- assertTrue("proposals are empty : ", !proposals.isEmpty());
+ assertFalse("proposals are empty : ", proposals.isEmpty());
System.out.println(proposals);
assertTrue("expected variable is not in proposals :", proposals.stream().anyMatch(p -> p.getDisplayString().equals("predicate : Predicate")));
} finally {
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/eval/Tests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/eval/Tests.java
index 499d1fc..40f2021 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/eval/Tests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/eval/Tests.java
@@ -462,7 +462,7 @@
} else {
message= exception.getStatus().getMessage();
}
- assertTrue(message, false);
+ fail(message);
}
return result.getValue();
}
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/launching/ClasspathShortenerTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/launching/ClasspathShortenerTests.java
index 22a1247..05f004b 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/launching/ClasspathShortenerTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/launching/ClasspathShortenerTests.java
@@ -14,6 +14,7 @@
package org.eclipse.jdt.debug.tests.launching;
import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertNotEquals;
import java.io.File;
import java.io.FileInputStream;
@@ -125,10 +126,10 @@
List<File> classpathJars = getClasspathJarsFromJarManifest(classpathShortener.getProcessTempFiles().get(0));
String filePathSuffix = new File(userHomePath("/workspace/myProject/bin")).getPath();
int index = classpathJars.get(0).getCanonicalFile().getPath().lastIndexOf(filePathSuffix);
- assertTrue("First Classpath jar file location not found", index != -1);
+ assertNotEquals("First Classpath jar file location not found", -1, index);
filePathSuffix = new File(userHomePath("/workspace/myProject/lib/lib 1.jar")).getPath();
index = classpathJars.get(1).getCanonicalFile().getPath().lastIndexOf(filePathSuffix);
- assertTrue("Second Classpath jar file location not found", index != -1);
+ assertNotEquals("Second Classpath jar file location not found", -1, index);
}
public void testArgFileUsedForLongClasspathOnJava9() throws Exception {
@@ -211,10 +212,10 @@
List<File> classpathJars = getClasspathJarsFromJarManifest(classpathShortener.getProcessTempFiles().get(0));
String filePathSuffix = new File(userHomePath("/workspace/myProject/bin")).getPath();
int index = classpathJars.get(0).getCanonicalFile().getPath().lastIndexOf(filePathSuffix);
- assertTrue("First Classpath jar file location not found", index != -1);
+ assertNotEquals("First Classpath jar file location not found", -1, index);
filePathSuffix = new File(userHomePath("/workspace/myProject/lib/lib 1.jar")).getPath();
index = classpathJars.get(1).getCanonicalFile().getPath().lastIndexOf(filePathSuffix);
- assertTrue("Second Classpath jar file location not found", index != -1);
+ assertNotEquals("Second Classpath jar file location not found", -1, index);
}
public void testClasspathEnvVariableUsedForLongClasspathOnJava8OnWindows() {
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/launching/ConfigurationEncodingTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/launching/ConfigurationEncodingTests.java
index 641178b..bd0b6a7 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/launching/ConfigurationEncodingTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/launching/ConfigurationEncodingTests.java
@@ -65,11 +65,11 @@
getResourcesPreferences().setValue(ResourcesPlugin.PREF_ENCODING, getDefaultEncoding());
System.setProperty("file.encoding", "UTF-16BE");
ILaunchConfiguration config = getLaunchConfiguration("LaunchHistoryTest");
- assertTrue("the configuration could not be found", config != null);
- assertTrue("there should be no encoding set on the configuration", config.getAttribute(DebugPlugin.ATTR_CONSOLE_ENCODING, (String)null) == null);
+ assertNotNull("the configuration could not be found", config);
+ assertTrue("there should be no encoding set on the configuration", config.getAttribute(DebugPlugin.ATTR_CONSOLE_ENCODING, (String) null) == null);
String encoding = getLaunchManager().getEncoding(config);
- assertTrue("The configuration encoding should not be null", encoding != null);
- assertTrue("The configuration encoding should match the file system encoding", encoding.equals(System.getProperty("file.encoding")));
+ assertNotNull("The configuration encoding should not be null", encoding);
+ assertEquals("The configuration encoding should match the file system encoding", encoding, System.getProperty("file.encoding"));
}
finally {
//ensure old encoding is restored
@@ -87,11 +87,11 @@
try {
getResourcesPreferences().setValue(ResourcesPlugin.PREF_ENCODING, "UTF-16");
ILaunchConfiguration config = getLaunchConfiguration("LaunchHistoryTest");
- assertTrue("the configuration could not be found", config != null);
- assertTrue("there should be no encoding set on the configuration", config.getAttribute(DebugPlugin.ATTR_CONSOLE_ENCODING, (String)null) == null);
+ assertNotNull("the configuration could not be found", config);
+ assertTrue("there should be no encoding set on the configuration", config.getAttribute(DebugPlugin.ATTR_CONSOLE_ENCODING, (String) null) == null);
String encoding = getLaunchManager().getEncoding(config);
- assertTrue("The configuration encoding should not be null", encoding != null);
- assertTrue("The configuration encoding should match the workbench preference system encoding", encoding.equals("UTF-16"));
+ assertNotNull("The configuration encoding should not be null", encoding);
+ assertEquals("The configuration encoding should match the workbench preference system encoding", "UTF-16", encoding);
}
finally {
//ensure old encoding is restored
@@ -105,17 +105,17 @@
public void testGetSpecificConfigurationEncoding() throws CoreException {
String oldencoding = ResourcesPlugin.getEncoding();
ILaunchConfiguration config = getLaunchConfiguration("LaunchHistoryTest");
- assertTrue("the configuration could not be found", config != null);
+ assertNotNull("the configuration could not be found", config);
IResource[] oldmapped = config.getMappedResources();
ILaunchConfigurationWorkingCopy copy = config.getWorkingCopy();
try {
getResourcesPreferences().setValue(ResourcesPlugin.PREF_ENCODING, getDefaultEncoding());
copy.setAttribute(DebugPlugin.ATTR_CONSOLE_ENCODING, "UTF-16");
copy.doSave();
- assertTrue("there should be an encoding set on the configuration", config.getAttribute(DebugPlugin.ATTR_CONSOLE_ENCODING, (String)null) != null);
+ assertTrue("there should be an encoding set on the configuration", config.getAttribute(DebugPlugin.ATTR_CONSOLE_ENCODING, (String) null) != null);
String encoding = getLaunchManager().getEncoding(config);
- assertTrue("The configuration encoding should not be null", encoding != null);
- assertTrue("The configuration encoding should match the file system encoding", encoding.equals("UTF-16"));
+ assertNotNull("The configuration encoding should not be null", encoding);
+ assertEquals("The configuration encoding should match the file system encoding", "UTF-16", encoding);
copy.setAttribute(DebugPlugin.ATTR_CONSOLE_ENCODING, (String)null);
copy.setMappedResources(null);
copy.doSave();
@@ -136,20 +136,20 @@
public void testGetSpecificResourceEncoding() throws CoreException {
String oldencoding = ResourcesPlugin.getEncoding();
ILaunchConfiguration config = getLaunchConfiguration("LaunchHistoryTest");
- assertTrue("the configuration could not be found", config != null);
- assertTrue("there should be no encoding set on the configuration", config.getAttribute(DebugPlugin.ATTR_CONSOLE_ENCODING, (String)null) == null);
+ assertNotNull("the configuration could not be found", config);
+ assertTrue("there should be no encoding set on the configuration", config.getAttribute(DebugPlugin.ATTR_CONSOLE_ENCODING, (String) null) == null);
IResource[] oldmapped = config.getMappedResources();
ILaunchConfigurationWorkingCopy copy = config.getWorkingCopy();
try {
getResourcesPreferences().setValue(ResourcesPlugin.PREF_ENCODING, "UTF-16LE");
IFile res = (IFile) getResource("MigrationTests.java");
- assertTrue("the resource MigrationTests.java should not be null", res != null);
+ assertNotNull("the resource MigrationTests.java should not be null", res);
copy.setMappedResources(new IResource[] {res});
copy.doSave();
res.setCharset("UTF-8", null);
String encoding = getLaunchManager().getEncoding(config);
- assertTrue("The configuration encoding should not be null", encoding != null);
- assertTrue("The configuration encoding should match the file system encoding", encoding.equals(res.getCharset()));
+ assertNotNull("The configuration encoding should not be null", encoding);
+ assertEquals("The configuration encoding should match the file system encoding", encoding, res.getCharset());
}
finally {
//ensure old encoding is restored
@@ -171,21 +171,21 @@
String resCharset = res.getCharset();
String res2Charset = res2.getCharset();
ILaunchConfiguration config = getLaunchConfiguration("LaunchHistoryTest");
- assertTrue("the configuration could not be found", config != null);
- assertTrue("there should be no encoding set on the configuration", config.getAttribute(DebugPlugin.ATTR_CONSOLE_ENCODING, (String)null) == null);
+ assertNotNull("the configuration could not be found", config);
+ assertTrue("there should be no encoding set on the configuration", config.getAttribute(DebugPlugin.ATTR_CONSOLE_ENCODING, (String) null) == null);
IResource[] oldmapped = config.getMappedResources();
ILaunchConfigurationWorkingCopy copy = config.getWorkingCopy();
try {
getResourcesPreferences().setValue(ResourcesPlugin.PREF_ENCODING, "UTF-16LE");
- assertTrue("the resource MigrationTests.java should not be null", res != null);
- assertTrue("the resource MigrationTests2.java should not be null", res2 != null);
+ assertNotNull("the resource MigrationTests.java should not be null", res);
+ assertNotNull("the resource MigrationTests2.java should not be null", res2);
copy.setMappedResources(new IResource[] {res, res2});
copy.doSave();
res.setCharset("UTF-16BE", null);
res2.setCharset("UTF-8", null);
String encoding = getLaunchManager().getEncoding(config);
- assertTrue("The configuration encoding should not be null", encoding != null);
- assertTrue("The configuration encoding should match the file system encoding", encoding.equals(res.getCharset()));
+ assertNotNull("The configuration encoding should not be null", encoding);
+ assertEquals("The configuration encoding should match the file system encoding", encoding, res.getCharset());
copy.setMappedResources(null);
copy.doSave();
}
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/launching/ConfigurationResourceMappingTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/launching/ConfigurationResourceMappingTests.java
index 3628a6c..77cf367 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/launching/ConfigurationResourceMappingTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/launching/ConfigurationResourceMappingTests.java
@@ -39,21 +39,21 @@
*/
public void testRemovingMappedResources1() throws CoreException {
ILaunchConfiguration config = getLaunchConfiguration("MigrationTests");
- assertTrue("the configuration cannot be null", config != null);
+ assertNotNull("the configuration cannot be null", config);
ILaunchConfigurationWorkingCopy copy = config.getWorkingCopy();
IResource[] mapped = copy.getMappedResources();
try {
if(mapped == null) {
//map some
IResource res = getResource("MigrationTests.java");
- assertTrue("the resource MigrationTests.java should not be null", res != null);
+ assertNotNull("the resource MigrationTests.java should not be null", res);
copy.setMappedResources(new IResource[] {res});
copy.doSave();
- assertTrue("a resource mapping should have been added", copy.getMappedResources() != null);
+ assertNotNull("a resource mapping should have been added", copy.getMappedResources());
}
copy.setMappedResources(null);
copy.doSave();
- assertTrue("the mapped resources should have been removed", copy.getMappedResources() == null);
+ assertNull("the mapped resources should have been removed", copy.getMappedResources());
}
finally {
//put back any mappings that might have been there
@@ -68,21 +68,21 @@
*/
public void testRemovingMappedResources2() throws CoreException {
ILaunchConfiguration config = getLaunchConfiguration("MigrationTests");
- assertTrue("the configuration cannot be null", config != null);
+ assertNotNull("the configuration cannot be null", config);
ILaunchConfigurationWorkingCopy copy = config.getWorkingCopy();
IResource[] mapped = copy.getMappedResources();
try {
if(mapped == null) {
//map some
IResource res = getResource("MigrationTests.java");
- assertTrue("the resource MigrationTests.java should not be null", res != null);
+ assertNotNull("the resource MigrationTests.java should not be null", res);
copy.setMappedResources(new IResource[] {res});
copy.doSave();
- assertTrue("a resource mapping should have been added", copy.getMappedResources() != null);
+ assertNotNull("a resource mapping should have been added", copy.getMappedResources());
}
copy.setMappedResources(new IResource[0]);
copy.doSave();
- assertTrue("the mapped resources should have been removed", copy.getMappedResources() == null);
+ assertNull("the mapped resources should have been removed", copy.getMappedResources());
}
finally {
//put back any mappings that might have been there
@@ -96,16 +96,16 @@
*/
public void testSetMappedResource() throws CoreException {
ILaunchConfiguration config = getLaunchConfiguration("MigrationTests");
- assertTrue("the configuration cannot be null", config != null);
+ assertNotNull("the configuration cannot be null", config);
ILaunchConfigurationWorkingCopy copy = config.getWorkingCopy();
IResource res = getResource("MigrationTests.java");
- assertTrue("the resource MigrationTests.java should not be null", res != null);
+ assertNotNull("the resource MigrationTests.java should not be null", res);
IResource[] oldmapped = copy.getMappedResources();
try {
copy.setMappedResources(new IResource[] {res});
copy.doSave();
IResource[] mapped = copy.getMappedResources();
- assertTrue("there should only be one resource mapped", mapped.length == 1);
+ assertEquals("there should only be one resource mapped", 1, mapped.length);
assertTrue("the one resource should be MigrationTests.java", mapped[0].equals(res));
}
finally {
@@ -121,18 +121,18 @@
*/
public void testSetMappedResources() throws CoreException {
ILaunchConfiguration config = getLaunchConfiguration("MigrationTests");
- assertTrue("the configuration cannot be null", config != null);
+ assertNotNull("the configuration cannot be null", config);
ILaunchConfigurationWorkingCopy copy = config.getWorkingCopy();
IResource res = getResource("MigrationTests.java"),
res2 = getResource("MigrationTests2.java");
- assertTrue("the resource MigrationTests.java should not be null", res != null);
- assertTrue("the resource MigrationTests2.java should not be null", res2 != null);
+ assertNotNull("the resource MigrationTests.java should not be null", res);
+ assertNotNull("the resource MigrationTests2.java should not be null", res2);
IResource[] oldmapped = copy.getMappedResources();
try {
copy.setMappedResources(new IResource[] {res, res2});
copy.doSave();
IResource[] mapped = copy.getMappedResources();
- assertTrue("there should be two resources mapped", mapped.length == 2);
+ assertEquals("there should be two resources mapped", 2, mapped.length);
assertTrue("the first resource should be MigrationTests.java", mapped[0].equals(res));
assertTrue("the second resource should be MigrationTests2.java", mapped[1].equals(res2));
}
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/launching/ContributedTabTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/launching/ContributedTabTests.java
index 1eed683..9170880 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/launching/ContributedTabTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/launching/ContributedTabTests.java
@@ -95,7 +95,7 @@
assertNotNull("java tab group cannot be null", javagroup); //$NON-NLS-1$
javagroup.createTabs(getLaunchConfigurationDialog(IDebugUIConstants.ID_DEBUG_LAUNCH_GROUP), ILaunchManager.DEBUG_MODE);
ILaunchConfigurationTab[] tabs = javagroup.getTabs();
- assertTrue("Alternate tab should be the last tab in the group", tabs[tabs.length-1].getClass().equals(JavaAlernateModeTab.class)); //$NON-NLS-1$
+ assertEquals("Alternate tab should be the last tab in the group", tabs[tabs.length - 1].getClass(), JavaAlernateModeTab.class); //$NON-NLS-1$
}
/**
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/launching/LaunchConfigurationManagerTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/launching/LaunchConfigurationManagerTests.java
index 7a9f68c..80f75f7 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/launching/LaunchConfigurationManagerTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/launching/LaunchConfigurationManagerTests.java
@@ -134,7 +134,7 @@
public void testGetLaunchShortcutsForCategory() {
assertNotNull("The launch configuration manager cannot be null", fLCM);
List<LaunchShortcutExtension> list = fLCM.getLaunchShortcuts("testing");
- assertTrue("there should be the testing shortcut", list.size() == 1);
+ assertEquals("there should be the testing shortcut", 1, list.size());
}
/**
@@ -178,7 +178,7 @@
assertNotNull("The launch configuration manager cannot be null", fLCM);
ILaunchGroup group = fLCM.getDefaultLaunchGroup("run");
assertNotNull("the default launch group cannot be null", group);
- assertTrue("the default launch group for run mode should be the debug contribution", group.getIdentifier().equals("org.eclipse.debug.ui.launchGroup.run"));
+ assertEquals("the default launch group for run mode should be the debug contribution", "org.eclipse.debug.ui.launchGroup.run", group.getIdentifier());
}
/**
@@ -189,7 +189,7 @@
assertNotNull("The launch configuration manager cannot be null", fLCM);
ILaunchGroup group = fLCM.getDefaultLaunchGroup("debug");
assertNotNull("the default launch group cannot be null", group);
- assertTrue("the default launch group for debug mode should be the debug contribution", group.getIdentifier().equals("org.eclipse.debug.ui.launchGroup.debug"));
+ assertEquals("the default launch group for debug mode should be the debug contribution", "org.eclipse.debug.ui.launchGroup.debug", group.getIdentifier());
}
/**
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/launching/LaunchConfigurationTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/launching/LaunchConfigurationTests.java
index 634161a..6220235 100755
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/launching/LaunchConfigurationTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/launching/LaunchConfigurationTests.java
@@ -89,9 +89,9 @@
* @throws Exception
*/
public void testSetName() throws Exception {
- assertEquals("The default name should be: 'Test'", config.getName(), "Test");
+ assertEquals("The default name should be: 'Test'", "Test", config.getName());
config.setNameProxy("newname");
- assertEquals("The new name should be: 'newname'", config.getName(), "newname");
+ assertEquals("The new name should be: 'newname'", "newname", config.getName());
//reset the name
config.setNameProxy("Test");
}
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/launching/LaunchDelegateTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/launching/LaunchDelegateTests.java
index bc19d6c..b79a460 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/launching/LaunchDelegateTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/launching/LaunchDelegateTests.java
@@ -191,6 +191,6 @@
HashSet<String> modes = new HashSet<>();
modes.add("alternate2"); //$NON-NLS-1$
modes.add("foo"); //$NON-NLS-1$
- assertTrue("Should not support modes: "+modes.toString(), !type.supportsModeCombination(modes)); //$NON-NLS-1$
+ assertFalse("Should not support modes: " + modes.toString(), type.supportsModeCombination(modes)); //$NON-NLS-1$
}
}
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/launching/LaunchShortcutTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/launching/LaunchShortcutTests.java
index 8530fef..051e1d0 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/launching/LaunchShortcutTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/launching/LaunchShortcutTests.java
@@ -57,7 +57,7 @@
LaunchShortcutExtension ext = getLaunchShortcutExtension(JAVA_LAUNCH_SHORTCUT_ID);
assertNotNull("java app shortcut not found", ext); //$NON-NLS-1$
String typeid = "org.eclipse.jdt.launching.foo"; //$NON-NLS-1$
- assertTrue("local java app shortcut should not support foo", !ext.getAssociatedConfigurationTypes().contains(typeid)); //$NON-NLS-1$
+ assertFalse("local java app shortcut should not support foo", ext.getAssociatedConfigurationTypes().contains(typeid)); //$NON-NLS-1$
}
/**
@@ -75,7 +75,7 @@
public void testAssociatedPerspectiveNotSupported() {
LaunchShortcutExtension ext = getLaunchShortcutExtension(TEST_LAUNCH_SHORTCUT);
assertNotNull("test shortcut not found", ext); //$NON-NLS-1$
- assertTrue("java app shortcut should not support foo perspective", !ext.getPerspectives().contains("org.eclipse.debug.ui.FooPerspective")); //$NON-NLS-1$ //$NON-NLS-2$
+ assertFalse("java app shortcut should not support foo perspective", ext.getPerspectives().contains("org.eclipse.debug.ui.FooPerspective")); //$NON-NLS-1$ //$NON-NLS-2$
}
/**
@@ -84,7 +84,7 @@
public void testGetLaunchShortcutPerspectiveCategory() {
LaunchConfigurationManager lcm = getLaunchConfigurationManager();
assertNotNull("launch configuration manager cannot be null", lcm); //$NON-NLS-1$
- assertTrue("there should be one shortcut for the debug perspective and testing category", lcm.getLaunchShortcuts("org.eclipse.debug.ui.DebugPerspective", TESTING).size() == 1); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals("there should be one shortcut for the debug perspective and testing category", 1, lcm.getLaunchShortcuts("org.eclipse.debug.ui.DebugPerspective", TESTING).size()); //$NON-NLS-1$ //$NON-NLS-2$
}
/**
@@ -93,7 +93,7 @@
public void testGetLaunchShortcutCategory() {
LaunchConfigurationManager lcm = getLaunchConfigurationManager();
assertNotNull("launch configuration manager cannot be null", lcm); //$NON-NLS-1$
- assertTrue("there should be one shortcut for the testing category", lcm.getLaunchShortcuts(TESTING).size() == 1); //$NON-NLS-1$
+ assertEquals("there should be one shortcut for the testing category", 1, lcm.getLaunchShortcuts(TESTING).size()); //$NON-NLS-1$
}
/**
@@ -117,7 +117,7 @@
LaunchShortcutExtension ext = list.get(0);
String descr = ext.getShortcutDescription("debug"); //$NON-NLS-1$
assertNotNull("The description should not be null for debug mode", descr); //$NON-NLS-1$
- assertTrue("The description should match the general one: General Description", descr.equals("General Description")); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals("The description should match the general one: General Description", "General Description", descr); //$NON-NLS-1$ //$NON-NLS-2$
}
/**
@@ -134,7 +134,7 @@
LaunchShortcutExtension ext = list.get(0);
String descr = ext.getShortcutDescription("run"); //$NON-NLS-1$
assertNotNull("The description should not be null for run mode", descr); //$NON-NLS-1$
- assertTrue("The description should match the specific run one: Run Description", descr.equals("Run Description")); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals("The description should match the specific run one: Run Description", "Run Description", descr); //$NON-NLS-1$ //$NON-NLS-2$
}
/**
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/launching/MigrationDelegateTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/launching/MigrationDelegateTests.java
index 55eabac..8b1ee2b 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/launching/MigrationDelegateTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/launching/MigrationDelegateTests.java
@@ -63,7 +63,7 @@
try{
assertTrue("LC: "+config.getName()+" should be a candidate for migration", config.isMigrationCandidate()); //$NON-NLS-1$ //$NON-NLS-2$
config.migrate();
- assertTrue("LC: "+config.getName()+" should not be a candidate for migration", !config.isMigrationCandidate()); //$NON-NLS-1$ //$NON-NLS-2$
+ assertFalse("LC: " + config.getName() + " should not be a candidate for migration", config.isMigrationCandidate()); //$NON-NLS-1$ //$NON-NLS-2$
}
finally {
config = null;
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/launching/PListParserTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/launching/PListParserTests.java
index 174e63f..c03c797 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/launching/PListParserTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/launching/PListParserTests.java
@@ -87,7 +87,7 @@
map.put("JVMVersion", "1.5.0_24");
assertEquals("Incorrect values parsed", map, jres[2]);
} else {
- assertTrue("Top level object should be an array", false);
+ fail("Top level object should be an array");
}
}
@@ -107,7 +107,7 @@
assertEquals("Should be 8 entries in the array", 8, jres.length);
} else {
- assertTrue("Top level object should be an array", false);
+ fail("Top level object should be an array");
}
}
@@ -127,7 +127,7 @@
assertEquals("Should be 2 entries in the array", 2, jres.length);
} else {
- assertTrue("Top level object should be an array", false);
+ fail("Top level object should be an array");
}
}
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/performance/BreakpointManagerPerfTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/performance/BreakpointManagerPerfTests.java
index f425d86..4829773 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/performance/BreakpointManagerPerfTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/performance/BreakpointManagerPerfTests.java
@@ -53,7 +53,7 @@
IBreakpoint[] generateBreakpoints(int count) throws Exception {
IType type = getType(fgTypeName);
assertNotNull("the type "+fgTypeName+" should exist", type);
- assertTrue("The type "+fgTypeName+" must be a file", type.getResource().getType() == IResource.FILE);
+ assertEquals("The type " + fgTypeName + " must be a file", IResource.FILE, type.getResource().getType());
IEditorPart editor = openEditor((IFile)type.getResource());
assertNotNull("the editor for "+fgTypeName+" should have been created", editor);
ArrayList<IBreakpoint> bps = new ArrayList<>(count);
@@ -84,7 +84,7 @@
tagAsSummary("Start Breakpoint Manager - 200 BPs", Dimension.ELAPSED_PROCESS);
try {
IBreakpoint[] bps = generateBreakpoints(200);
- assertTrue("There should be 200 breakpoints", bps.length == 200);
+ assertEquals("There should be 200 breakpoints", 200, bps.length);
BreakpointManager mgr = (BreakpointManager) getBreakpointManager();
//clean it up before starting
mgr.shutdown();
@@ -114,7 +114,7 @@
tagAsSummary("Start Breakpoint Manager - 50 BPs", Dimension.ELAPSED_PROCESS);
try {
IBreakpoint[] bps = generateBreakpoints(50);
- assertTrue("There should be 50 breakpoints", bps.length == 50);
+ assertEquals("There should be 50 breakpoints", 50, bps.length);
BreakpointManager mgr = (BreakpointManager) getBreakpointManager();
//clean it up before starting
mgr.shutdown();
@@ -144,7 +144,7 @@
tagAsSummary("Start Breakpoint Manager - 100 BPs", Dimension.ELAPSED_PROCESS);
try {
IBreakpoint[] bps = generateBreakpoints(100);
- assertTrue("There should be 100 breakpoints", bps.length == 100);
+ assertEquals("There should be 100 breakpoints", 100, bps.length);
BreakpointManager mgr = (BreakpointManager) getBreakpointManager();
//clean it up before starting
mgr.shutdown();
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/performance/PerfSteppingTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/performance/PerfSteppingTests.java
index 0677e94..02657ad 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/performance/PerfSteppingTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/performance/PerfSteppingTests.java
@@ -76,12 +76,12 @@
try {
fThread.stepOver();
} catch (DebugException e) {
- assertTrue(e.getMessage(), false);
+ fail(e.getMessage());
}
try {
fLock.wait();
} catch (InterruptedException e) {
- assertTrue(e.getMessage(), false);
+ fail(e.getMessage());
}
}
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/sourcelookup/ExternalArchiveSourceContainerTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/sourcelookup/ExternalArchiveSourceContainerTests.java
index 33f269a..ac9c412 100755
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/sourcelookup/ExternalArchiveSourceContainerTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/sourcelookup/ExternalArchiveSourceContainerTests.java
@@ -60,7 +60,7 @@
return container;
}
}
- assertTrue("Did not find JRE source archive. This failure is expected if you are running the tests with a JRE that does not contain source.", false);
+ fail("Did not find JRE source archive. This failure is expected if you are running the tests with a JRE that does not contain source.");
return null;
}
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/sourcelookup/JarSourceLookupTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/sourcelookup/JarSourceLookupTests.java
index 102939e..df40b79 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/sourcelookup/JarSourceLookupTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/sourcelookup/JarSourceLookupTests.java
@@ -100,10 +100,8 @@
break;
}
}
- if (!foundJar) {
- fail("The .classpath from project " + jarRefProject + " is unexpected and does not have an entry for " + SAMPLE_JAR_PATH + ": "
- + new String(Files.readAllBytes(path)));
- }
+ assertTrue("The .classpath from project " + jarRefProject + " is unexpected and does not have an entry for " + SAMPLE_JAR_PATH + ": "
+ + new String(Files.readAllBytes(path)), foundJar);
waitForBuild();
}
@@ -232,7 +230,7 @@
Object source = lookupSource(frame);
assertNotNull("We should have found source for the main class testJar.RunJar", source);
assertTrue("The found source should be an IFile", source instanceof IFile);
- assertEquals("We should have found a file named RunJar.java", ((IFile)source).getName(), "RunJar.java");
+ assertEquals("We should have found a file named RunJar.java", "RunJar.java", ((IFile) source).getName());
stepInto((IJavaStackFrame)frame);
frame = thread.getTopStackFrame();
@@ -241,7 +239,7 @@
source = lookupSource(frame);
assertNotNull("We should have found source for the jar class a.JarClass", source);
assertTrue("The found source should be a ClassFile", source instanceof ClassFile);
- assertEquals("we should have found a file named a.JarClass.class", ((ClassFile)source).getElementName(), "JarClass.class");
+ assertEquals("we should have found a file named a.JarClass.class", "JarClass.class", ((ClassFile) source).getElementName());
}
finally {
terminateAndRemove(thread);
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/sourcelookup/SourceLocationTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/sourcelookup/SourceLocationTests.java
index 18e04af..b9fe64d 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/sourcelookup/SourceLocationTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/sourcelookup/SourceLocationTests.java
@@ -140,12 +140,12 @@
Object source = location.findSourceElement("Breakpoints");
assertTrue("Did not find source for 'Breakpoints'", source instanceof ICompilationUnit);
ICompilationUnit cu = (ICompilationUnit)source;
- assertEquals("Did not find source for 'Breakpoints'", cu.getElementName(), "Breakpoints.java");
+ assertEquals("Did not find source for 'Breakpoints'", "Breakpoints.java", cu.getElementName());
source = location.findSourceElement("org.eclipse.debug.tests.targets.InfiniteLoop");
assertTrue("Did not find source for 'InfiniteLoop'", source instanceof ICompilationUnit);
cu = (ICompilationUnit)source;
- assertEquals("Did not find source for 'Breakpoints'", cu.getElementName(), "InfiniteLoop.java");
+ assertEquals("Did not find source for 'Breakpoints'", "InfiniteLoop.java", cu.getElementName());
}
public void testNegativeSourceFolderSourceLocation() throws Exception {
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/sourcelookup/SourceLookupTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/sourcelookup/SourceLookupTests.java
index aba5dcd..7c465ce 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/sourcelookup/SourceLookupTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/sourcelookup/SourceLookupTests.java
@@ -53,7 +53,7 @@
return;
}
}
- assertTrue("Failed to locate package fragment root", false);
+ fail("Failed to locate package fragment root");
}
/**
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/ui/DetailPaneManagerTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/ui/DetailPaneManagerTests.java
index 51ded11..7aa08b4 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/ui/DetailPaneManagerTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/ui/DetailPaneManagerTests.java
@@ -67,20 +67,20 @@
*/
public void testGetUserPreferredDetailPane() {
String id = fManager.getUserPreferredDetailPane(new HashSet<String>());
- assertEquals("Incorrect pane ID", null, id);
+ assertNull("Incorrect pane ID", id);
Set<String> detailPanes = new HashSet<>();
detailPanes.add("NewPane1");
id = fManager.getUserPreferredDetailPane(detailPanes);
- assertEquals("Incorrect pane ID", null, id);
+ assertNull("Incorrect pane ID", id);
detailPanes.add("NewPane2");
id = fManager.getUserPreferredDetailPane(detailPanes);
- assertEquals("Incorrect pane ID", null, id);
+ assertNull("Incorrect pane ID", id);
detailPanes.add(DefaultDetailPane.ID);
id = fManager.getUserPreferredDetailPane(detailPanes);
- assertEquals("Incorrect pane ID", null, id);
+ assertNull("Incorrect pane ID", id);
detailPanes.clear();
detailPanes.add(DefaultDetailPane.ID);
@@ -95,11 +95,11 @@
public void testSetPreferredDetailPane() {
fManager.setPreferredDetailPane(null, null);
String id = fManager.getUserPreferredDetailPane(null);
- assertEquals("Incorrect pane ID", null, id);
+ assertNull("Incorrect pane ID", id);
fManager.setPreferredDetailPane(null, "Example");
id = fManager.getUserPreferredDetailPane(null);
- assertEquals("Incorrect pane ID", null, id);
+ assertNull("Incorrect pane ID", id);
Set<String> detailPanes = new HashSet<>();
detailPanes.add("Example1");
@@ -114,7 +114,7 @@
detailPanes.add(DefaultDetailPane.ID);
id = fManager.getUserPreferredDetailPane(detailPanes);
- assertEquals("Incorrect pane ID", null, id);
+ assertNull("Incorrect pane ID", id);
fManager.setPreferredDetailPane(detailPanes, "Example2");
id = fManager.getUserPreferredDetailPane(detailPanes);
assertEquals("Incorrect pane ID", "Example2", id);
@@ -212,10 +212,10 @@
*/
public void testGetNameFromID() {
String name = fManager.getNameFromID(null);
- assertEquals("Incorrect name returned",null,name);
+ assertNull("Incorrect name returned", name);
name = fManager.getNameFromID("ThisPaneDoesNotExist");
- assertEquals("Incorrect name returned",null,name);
+ assertNull("Incorrect name returned", name);
name = fManager.getNameFromID(DefaultDetailPane.ID);
assertEquals("Incorrect name returned",DefaultDetailPane.NAME,name);
@@ -231,10 +231,10 @@
*/
public void testGetDescriptionFromID() {
String description = fManager.getDescriptionFromID(null);
- assertEquals("Incorrect name returned",null,description);
+ assertNull("Incorrect name returned", description);
description = fManager.getDescriptionFromID("ThisPaneDoesNotExist");
- assertEquals("Incorrect name returned",null,description);
+ assertNull("Incorrect name returned", description);
description = fManager.getDescriptionFromID(DefaultDetailPane.ID);
assertEquals("Incorrect name returned",DefaultDetailPane.DESCRIPTION,description);
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/ui/InstructionPointerManagerTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/ui/InstructionPointerManagerTests.java
index f0e70e4..0ee33a3 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/ui/InstructionPointerManagerTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/ui/InstructionPointerManagerTests.java
@@ -509,9 +509,7 @@
IEditorInput editorInput = editor.getEditorInput();
// If there is no annotation model, there's nothing more to do
IAnnotationModel annModel = docProvider.getAnnotationModel(editorInput);
- if (annModel == null) {
- fail("Could not get the annotation model");
- }
+ assertNotNull("Could not get the annotation model", annModel);
annModel.addAnnotationModelListener(getAnnotationListener());
fAnnotationModelsWithListeners.add(annModel);
} else {
@@ -568,9 +566,7 @@
IEditorInput editorInput = editor.getEditorInput();
// If there is no annotation model, there's nothing more to do
IAnnotationModel annModel = docProvider.getAnnotationModel(editorInput);
- if (annModel == null) {
- fail("Could not get the annotation model");
- }
+ assertNotNull("Could not get the annotation model", annModel);
annModel.addAnnotationModelListener(getAnnotationListener());
fAnnotationModelsWithListeners.add(annModel);
} else {
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/ui/presentation/ModelPresentationTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/ui/presentation/ModelPresentationTests.java
index b996ff5..090dfdc 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/ui/presentation/ModelPresentationTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/ui/presentation/ModelPresentationTests.java
@@ -51,7 +51,7 @@
TestIJavaValue value = new TestIJavaValue(type, "<unknown>", null, "<unknown>", null);
String val = pres.getValueText(value);
assertNotNull("the value should have been computed", val);
- assertEquals("The value text should be '<unknown>'", val, "<unknown>");
+ assertEquals("The value text should be '<unknown>'", "<unknown>", val);
}
finally {
pres.dispose();
@@ -93,7 +93,7 @@
TestIJavaValue value = new TestIJavaValue(type, sig, null, "org.test.MyClass", "test Java value");
String val = pres.getValueText(value);
assertNotNull("the value should have been computed", val);
- assertEquals("The value text should be '\"MyClass test Java value\"'", val, "MyClass test Java value");
+ assertEquals("The value text should be '\"MyClass test Java value\"'", "MyClass test Java value", val);
}
finally {
pres.dispose();
@@ -113,7 +113,7 @@
TestIJavaValue value = new TestIJavaValue(type, sig, null, "org.test.MyClass", "test Java value");
String val = pres.getValueText(value);
assertNotNull("the value should have been computed", val);
- assertEquals("The value text should be '\"MyClass test Java value\"'", val, "MyClass test Java value");
+ assertEquals("The value text should be '\"MyClass test Java value\"'", "MyClass test Java value", val);
}
finally {
pres.dispose();
@@ -136,7 +136,7 @@
});
String val = pres.getValueText(value);
assertNotNull("the value should have been computed", val);
- assertEquals("The value text should be 'MyClass My Array'", val, "MyClass My Array");
+ assertEquals("The value text should be 'MyClass My Array'", "MyClass My Array", val);
}
finally {
pres.dispose();
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/variables/DetailFormatterTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/variables/DetailFormatterTests.java
index e5e55b3..23061d8 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/variables/DetailFormatterTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/variables/DetailFormatterTests.java
@@ -107,8 +107,7 @@
Thread.sleep(100);
}
assertNotNull("The IValue of the detailComputed callback cannot be null", fListener.value);
- assertTrue("The map should be an instance of java.util.LinkedHashMap",
- Signature.getTypeErasure(fListener.value.getReferenceTypeName()).equals("java.util.LinkedHashMap"));
+ assertEquals("The map should be an instance of java.util.LinkedHashMap", "java.util.LinkedHashMap", Signature.getTypeErasure(fListener.value.getReferenceTypeName()));
assertNotNull("The computed value of the detail should not be null", fListener.result);
}
finally {
@@ -145,8 +144,7 @@
Thread.sleep(100);
}
assertNotNull("The IValue of the detailComputed callback cannot be null", fListener.value);
- assertTrue("The map should be an instance of java.util.LinkedHashMap",
- Signature.getTypeErasure(fListener.value.getReferenceTypeName()).equals("java.util.LinkedHashMap"));
+ assertEquals("The map should be an instance of java.util.LinkedHashMap", "java.util.LinkedHashMap", Signature.getTypeErasure(fListener.value.getReferenceTypeName()));
assertNotNull("The computed value of the detail should not be null", fListener.result);
}
finally {
@@ -181,8 +179,7 @@
Thread.sleep(100);
}
assertNotNull("The IValue of the detailComputed callback cannot be null", fListener.value);
- assertTrue("The map should be an instance of java.util.LinkedHashMap",
- Signature.getTypeErasure(fListener.value.getReferenceTypeName()).equals("java.util.LinkedHashMap"));
+ assertEquals("The map should be an instance of java.util.LinkedHashMap", "java.util.LinkedHashMap", Signature.getTypeErasure(fListener.value.getReferenceTypeName()));
assertNotNull("The computed value of the detail should not be null", fListener.result);
}
finally {
@@ -217,8 +214,7 @@
Thread.sleep(100);
}
assertNotNull("The IValue of the detailComputed callback cannot be null", fListener.value);
- assertTrue("The map should be an instance of java.util.LinkedHashMap",
- Signature.getTypeErasure(fListener.value.getReferenceTypeName()).equals("java.util.LinkedHashMap"));
+ assertEquals("The map should be an instance of java.util.LinkedHashMap", "java.util.LinkedHashMap", Signature.getTypeErasure(fListener.value.getReferenceTypeName()));
assertNotNull("The computed value of the detail should not be null", fListener.result);
}
finally {
@@ -253,8 +249,7 @@
Thread.sleep(100);
}
assertNotNull("The IValue of the detailComputed callback cannot be null", fListener.value);
- assertTrue("The map should be an instance of java.util.LinkedHashMap",
- Signature.getTypeErasure(fListener.value.getReferenceTypeName()).equals("java.util.LinkedHashMap"));
+ assertEquals("The map should be an instance of java.util.LinkedHashMap", "java.util.LinkedHashMap", Signature.getTypeErasure(fListener.value.getReferenceTypeName()));
assertNotNull("The computed value of the detail should not be null", fListener.result);
assertTrue("The returned value from (true && true || !(false&&true) || !(true==true||true!=true&&true)) should be true",
Boolean.parseBoolean(fListener.result));
@@ -291,8 +286,7 @@
Thread.sleep(100);
}
assertNotNull("The IValue of the detailComputed callback cannot be null", fListener.value);
- assertTrue("The map should be an instance of java.util.LinkedHashMap",
- Signature.getTypeErasure(fListener.value.getReferenceTypeName()).equals("java.util.LinkedHashMap"));
+ assertEquals("The map should be an instance of java.util.LinkedHashMap", "java.util.LinkedHashMap", Signature.getTypeErasure(fListener.value.getReferenceTypeName()));
assertNotNull("The computed value of the detail should not be null", fListener.result);
assertFalse("The returned value from !true should be false", Boolean.parseBoolean(fListener.result));
}
@@ -328,8 +322,7 @@
Thread.sleep(100);
}
assertNotNull("The IValue of the detailComputed callback cannot be null", fListener.value);
- assertTrue("The map should be an instance of java.util.LinkedHashMap",
- Signature.getTypeErasure(fListener.value.getReferenceTypeName()).equals("java.util.LinkedHashMap"));
+ assertEquals("The map should be an instance of java.util.LinkedHashMap", "java.util.LinkedHashMap", Signature.getTypeErasure(fListener.value.getReferenceTypeName()));
assertNotNull("The computed value of the detail should not be null", fListener.result);
assertFalse("The returned value from !(true==true||true!=true&&true) should be false", Boolean.parseBoolean(fListener.result));
}
diff --git a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/RuntimeClasspathEntry.java b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/RuntimeClasspathEntry.java
index 7190816..d300f32 100644
--- a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/RuntimeClasspathEntry.java
+++ b/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/RuntimeClasspathEntry.java
@@ -284,8 +284,8 @@
Document doc = DebugPlugin.newDocument();
Element node = doc.createElement("runtimeClasspathEntry"); //$NON-NLS-1$
doc.appendChild(node);
- node.setAttribute("type", (Integer.valueOf(getType())).toString()); //$NON-NLS-1$
- node.setAttribute("path", (Integer.valueOf(getClasspathProperty())).toString()); //$NON-NLS-1$
+ node.setAttribute("type", Integer.toString(getType())); //$NON-NLS-1$
+ node.setAttribute("path", Integer.toString(getClasspathProperty())); //$NON-NLS-1$
switch (getType()) {
case PROJECT :
node.setAttribute("projectName", getPath().lastSegment()); //$NON-NLS-1$