Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2011-01-07 18:19:34 +0000
committerEike Stepper2011-01-07 18:19:34 +0000
commit1b444a7f40246178d93268fef9c4d56c5c168003 (patch)
treeaa4b042a42a6dde02e9d2cc317f4cdf0a6bdae00 /plugins/org.eclipse.net4j.tests
parent85526250336e72dac2ebd742219905dbbb8a2e0c (diff)
downloadcdo-1b444a7f40246178d93268fef9c4d56c5c168003.tar.gz
cdo-1b444a7f40246178d93268fef9c4d56c5c168003.tar.xz
cdo-1b444a7f40246178d93268fef9c4d56c5c168003.zip
Never use assertTrue() or assertFalse()
Diffstat (limited to 'plugins/org.eclipse.net4j.tests')
-rw-r--r--plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/TCPConnectorTest.java4
-rw-r--r--plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/defs/JVMAcceptorDefImplTest.java4
-rw-r--r--plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/defs/JVMConnectorDefImplTest.java2
-rw-r--r--plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/defs/TCPAcceptorDefImplTest.java6
-rw-r--r--plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/defs/TCPConnectorDefImplTest.java12
-rw-r--r--plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/util/tests/AbstractOMTest.java27
-rw-r--r--plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/util/tests/MonitorTest.java4
-rw-r--r--plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/util/tests/defs/TestDefTest.java34
8 files changed, 59 insertions, 34 deletions
diff --git a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/TCPConnectorTest.java b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/TCPConnectorTest.java
index 6db1dc18a4..82a192aa62 100644
--- a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/TCPConnectorTest.java
+++ b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/TCPConnectorTest.java
@@ -517,7 +517,7 @@ public class TCPConnectorTest extends AbstractOMTest
channels[i] = c;
}
- assertTrue(queue.isEmpty());
+ assertEquals(true, queue.isEmpty());
assertNull(queue.peek());
assertNull(queue.poll());
@@ -542,7 +542,7 @@ public class TCPConnectorTest extends AbstractOMTest
assertSame(peek1, poll);
}
- assertTrue(queue.isEmpty());
+ assertEquals(true, queue.isEmpty());
assertNull(queue.peek());
assertNull(queue.poll());
}
diff --git a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/defs/JVMAcceptorDefImplTest.java b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/defs/JVMAcceptorDefImplTest.java
index 2d07b3d270..fbb70453e3 100644
--- a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/defs/JVMAcceptorDefImplTest.java
+++ b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/defs/JVMAcceptorDefImplTest.java
@@ -59,12 +59,12 @@ public class JVMAcceptorDefImplTest extends AbstractOMTest
IJVMAcceptor jvmAcceptor = (IJVMAcceptor)jvmAcceptorDef.getInstance();
- assertTrue(LifecycleUtil.isActive(jvmAcceptor));
+ assertEquals(true, LifecycleUtil.isActive(jvmAcceptor));
LifecycleUtil.activate(jvmConnector);
jvmConnector.waitForConnection(DELAY + TIMEOUT);
- assertTrue(LifecycleUtil.isActive(jvmConnector));
+ assertEquals(true, LifecycleUtil.isActive(jvmConnector));
LifecycleUtil.deactivate(jvmAcceptor);
}
diff --git a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/defs/JVMConnectorDefImplTest.java b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/defs/JVMConnectorDefImplTest.java
index b9ea7be43a..2ff6bb6c1c 100644
--- a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/defs/JVMConnectorDefImplTest.java
+++ b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/defs/JVMConnectorDefImplTest.java
@@ -55,7 +55,7 @@ public class JVMConnectorDefImplTest extends AbstractOMTest
jvmConnectorDef.setName(NAME);
IJVMConnector jvmConnector = (IJVMConnector)jvmConnectorDef.getInstance();
jvmConnector.connect(500L);
- assertTrue(jvmConnector.isConnected());
+ assertEquals(true, jvmConnector.isConnected());
LifecycleUtil.deactivate(jvmConnector);
LifecycleUtil.deactivate(jvmAcceptor);
diff --git a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/defs/TCPAcceptorDefImplTest.java b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/defs/TCPAcceptorDefImplTest.java
index 13ceb958d2..e1ac65843e 100644
--- a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/defs/TCPAcceptorDefImplTest.java
+++ b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/defs/TCPAcceptorDefImplTest.java
@@ -59,11 +59,11 @@ public class TCPAcceptorDefImplTest extends AbstractOMTest
ITCPAcceptor tcpAcceptor = (ITCPAcceptor)tcpAcceptorDef.getInstance();
- assertTrue(LifecycleUtil.isActive(tcpAcceptor));
+ assertEquals(true, LifecycleUtil.isActive(tcpAcceptor));
LifecycleUtil.activate(tcpConnector);
tcpConnector.waitForConnection(DELAY + TIMEOUT);
- assertTrue(LifecycleUtil.isActive(tcpConnector));
+ assertEquals(true, LifecycleUtil.isActive(tcpConnector));
LifecycleUtil.deactivate(tcpAcceptor);
}
@@ -88,7 +88,7 @@ public class TCPAcceptorDefImplTest extends AbstractOMTest
tcpAcceptorDef.setNegotiator(challengeNegotiatorDef);
ITCPAcceptor tcpAcceptor = (ITCPAcceptor)tcpAcceptorDef.getInstance();
- assertTrue(LifecycleUtil.isActive(tcpAcceptor));
+ assertEquals(true, LifecycleUtil.isActive(tcpAcceptor));
Util.addNegotiator(USERID, PASSWORD, tcpConnector);
LifecycleUtil.activate(tcpConnector);
diff --git a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/defs/TCPConnectorDefImplTest.java b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/defs/TCPConnectorDefImplTest.java
index 3588690043..b7a5dacb37 100644
--- a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/defs/TCPConnectorDefImplTest.java
+++ b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/tests/defs/TCPConnectorDefImplTest.java
@@ -63,7 +63,7 @@ public class TCPConnectorDefImplTest extends AbstractProtocolTest
ITCPConnector tcpConnector = (ITCPConnector)tcpConnectorDef.getInstance();
tcpConnector.waitForConnection(DELAY + TIMEOUT);
- assertTrue(LifecycleUtil.isActive(tcpConnector));
+ assertEquals(true, LifecycleUtil.isActive(tcpConnector));
LifecycleUtil.deactivate(tcpConnector);
}
@@ -81,13 +81,13 @@ public class TCPConnectorDefImplTest extends AbstractProtocolTest
ITCPConnector thisTcpConnector = (ITCPConnector)tcpConnectorDef.getInstance();
tcpConnectorDef.setPort(PORT + 1);
- assertTrue(tcpConnectorDef.isTouched());
+ assertEquals(true, tcpConnectorDef.isTouched());
ITCPConnector thatTcpConnector = (ITCPConnector)tcpConnectorDef.getInstance();
- assertTrue(!LifecycleUtil.isActive(thisTcpConnector));
- assertTrue(!tcpConnectorDef.isTouched());
- assertTrue(thisTcpConnector != thatTcpConnector);
+ assertEquals(true, !LifecycleUtil.isActive(thisTcpConnector));
+ assertEquals(true, !tcpConnectorDef.isTouched());
+ assertEquals(true, thisTcpConnector != thatTcpConnector);
LifecycleUtil.deactivate(thisTcpConnector);
LifecycleUtil.deactivate(thatTcpConnector);
@@ -117,7 +117,7 @@ public class TCPConnectorDefImplTest extends AbstractProtocolTest
ITCPConnector tcpConnector = (ITCPConnector)tcpConnectorDef.getInstance();
tcpConnector.waitForConnection(DELAY + TIMEOUT);
- assertTrue(LifecycleUtil.isActive(tcpConnector));
+ assertEquals(true, LifecycleUtil.isActive(tcpConnector));
LifecycleUtil.deactivate(tcpConnector);
diff --git a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/util/tests/AbstractOMTest.java b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/util/tests/AbstractOMTest.java
index c5f5b22510..1b33f0d3c6 100644
--- a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/util/tests/AbstractOMTest.java
+++ b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/util/tests/AbstractOMTest.java
@@ -250,6 +250,30 @@ public abstract class AbstractOMTest extends TestCase
{
}
+ @Deprecated
+ public static void assertTrue(String message, boolean condition)
+ {
+ throw new UnsupportedOperationException("Use assertEquals()");
+ }
+
+ @Deprecated
+ public static void assertTrue(boolean condition)
+ {
+ throw new UnsupportedOperationException("Use assertEquals()");
+ }
+
+ @Deprecated
+ public static void assertFalse(String message, boolean condition)
+ {
+ throw new UnsupportedOperationException("Use assertEquals()");
+ }
+
+ @Deprecated
+ public static void assertFalse(boolean condition)
+ {
+ throw new UnsupportedOperationException("Use assertEquals()");
+ }
+
public static void assertEquals(Object[] expected, Object[] actual)
{
if (!Arrays.deepEquals(expected, actual))
@@ -299,7 +323,8 @@ public abstract class AbstractOMTest extends TestCase
public static void assertInstanceOf(Class<?> expected, Object object)
{
- assertTrue("Not an instance of " + expected + ": " + object.getClass().getName(), expected.isInstance(object));
+ assertEquals("Not an instance of " + expected + ": " + object.getClass().getName(), true,
+ expected.isInstance(object));
}
public static void assertActive(Object object) throws InterruptedException
diff --git a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/util/tests/MonitorTest.java b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/util/tests/MonitorTest.java
index 279030e237..70b9aa6f5e 100644
--- a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/util/tests/MonitorTest.java
+++ b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/util/tests/MonitorTest.java
@@ -288,8 +288,8 @@ public class MonitorTest extends AbstractOMTest
double newWork = main.getWork();
System.out.println(newWork);
- // assertTrue("Worked not enough: " + work, newWork > work);
- // assertTrue("Worked too much: " + newWork, newWork < OMMonitor.ONE + OMMonitor.ONE);
+ // assertEquals(true, "Worked not enough: " + work, newWork > work);
+ // assertEquals(true, "Worked too much: " + newWork, newWork < OMMonitor.ONE + OMMonitor.ONE);
work = newWork;
}
diff --git a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/util/tests/defs/TestDefTest.java b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/util/tests/defs/TestDefTest.java
index ba48a03470..df92dd3ffd 100644
--- a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/util/tests/defs/TestDefTest.java
+++ b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/util/tests/defs/TestDefTest.java
@@ -42,21 +42,21 @@ public class TestDefTest extends AbstractOMTest
{
Object thisInstance = def.getInstance();
Object thatInstance = def.getInstance();
- assertTrue(thisInstance == thatInstance);
+ assertEquals(true, thisInstance == thatInstance);
}
public void testInstanceCreatedIsActivated()
{
Object instance = def.getInstance();
- assertTrue(LifecycleUtil.isActive(instance));
+ assertEquals(true, LifecycleUtil.isActive(instance));
}
public void testInstanceDeactivatesIfUnset()
{
Object instance = def.getInstance();
def.unsetInstance();
- assertTrue(((DefImpl)def).getInternalInstance() == null);
- assertTrue(!LifecycleUtil.isActive(instance));
+ assertEquals(true, ((DefImpl)def).getInternalInstance() == null);
+ assertEquals(true, !LifecycleUtil.isActive(instance));
}
public void testNewInstanceIsCreatedIfDefWasTouchedAfterwards() throws Exception
@@ -78,7 +78,7 @@ public class TestDefTest extends AbstractOMTest
Object thisInstance = def.getInstance();
Object thatInstance = def.getInstance();
- assertTrue(thatInstance != thisInstance);
+ assertEquals(true, thatInstance != thisInstance);
}
public void testSameInstanceIfDefWasntTouched() throws Exception
@@ -100,39 +100,39 @@ public class TestDefTest extends AbstractOMTest
Object thisInstance = def.getInstance();
Object thatInstance = def.getInstance();
- assertTrue(thatInstance == thisInstance);
+ assertEquals(true, thatInstance == thisInstance);
}
public void testSetAttributeTouches()
{
TestDef def = createTestDef();
- assertTrue(!def.isTouched());
+ assertEquals(true, !def.isTouched());
def.setAttribute("aValue"); //$NON-NLS-1$
- assertTrue(def.isTouched());
+ assertEquals(true, def.isTouched());
def.getInstance(); // clears touched
- assertTrue(!def.isTouched());
+ assertEquals(true, !def.isTouched());
}
public void testAddReferenceTouches()
{
TestDef def = createTestDef();
- assertTrue(!def.isTouched());
+ assertEquals(true, !def.isTouched());
def.getReferences().add(createTestDef());
- assertTrue(def.isTouched());
+ assertEquals(true, def.isTouched());
}
public void testSetInReferencedDefTouchesReferenchingDef()
{
TestDef def = createTestDef();
- assertTrue(!def.isTouched());
+ assertEquals(true, !def.isTouched());
TestDef referencedDef = createTestDef();
def.getReferences().add(referencedDef);
- assertTrue(!referencedDef.isTouched());
+ assertEquals(true, !referencedDef.isTouched());
referencedDef.setAttribute("newValue"); //$NON-NLS-1$
- assertTrue(referencedDef.isTouched());
- assertTrue(def.isTouched());
+ assertEquals(true, referencedDef.isTouched());
+ assertEquals(true, def.isTouched());
}
public void testNewInstanceIsCreatedIfCurrentIsDeactivated() throws Exception
@@ -143,7 +143,7 @@ public class TestDefTest extends AbstractOMTest
// Wait until instance gets deactivated
thisInstance.waitForDeactivation();
BlockingToken thatInstance = (BlockingToken)def.getInstance();
- assertTrue(thatInstance != thisInstance);
+ assertEquals(true, thatInstance != thisInstance);
}
public void testNewInstanceIsCreatedIfCurrentIsUnset() throws Exception
@@ -154,7 +154,7 @@ public class TestDefTest extends AbstractOMTest
// Wait until instance gets deactivated
thisInstance.waitForDeactivation();
BlockingToken thatInstance = (BlockingToken)def.getInstance();
- assertTrue(thatInstance != thisInstance);
+ assertEquals(true, thatInstance != thisInstance);
}
private TestDef createTestDef()

Back to the top