Fix several tests to use correct junit methods 21/2221/2
authorAlissa Bonas <abonas@redhat.com>
Mon, 28 Oct 2013 14:58:44 +0000 (16:58 +0200)
committerGerrit Code Review <gerrit@opendaylight.org>
Mon, 28 Oct 2013 15:17:24 +0000 (15:17 +0000)
Change-Id: I61c7eca9c448f50140fd206ee4665bd2d58c0b65
Signed-off-by: Alissa Bonas <abonas@redhat.com>
opendaylight/forwarding/staticrouting/src/test/java/org/opendaylight/controller/forwarding/staticrouting/StaticRouteTest.java
opendaylight/forwardingrulesmanager/integrationtest/src/test/java/org/opendaylight/controller/forwardingrulesmanager/internal/ForwardingRulesManagerIT.java
opendaylight/northbound/topology/src/test/java/org/opendaylight/controller/topology/northbound/TopologyTest.java

index 25b2dac..ee0e9dc 100644 (file)
@@ -22,6 +22,8 @@ import org.opendaylight.controller.sal.core.NodeConnector;
 import org.opendaylight.controller.sal.utils.NodeConnectorCreator;
 import org.opendaylight.controller.sal.utils.NodeCreator;
 
+import static junit.framework.Assert.fail;
+
 public class StaticRouteTest {
 
         @Test
@@ -36,7 +38,7 @@ public class StaticRouteTest {
                         nextHopAddress = InetAddress.getByName("200.0.0.1");
 
                 } catch (UnknownHostException e) {
-                        Assert.assertTrue(false);
+                        fail("Failed due to unknown host " + e.getMessage());
                 }
                 staticRoute.setNetworkAddress(networkAddress);
                 Assert.assertEquals(networkAddress.getHostAddress(), staticRoute.getNetworkAddress().getHostAddress());
@@ -57,12 +59,12 @@ public class StaticRouteTest {
         try {
             ip1 = InetAddress.getByName("192.1.1.1");
         } catch (UnknownHostException e) {
-            Assert.assertTrue(false);
+            fail("Failed due to unknown host " + e.getMessage());
         }
         try {
             h1 = new HostNodeConnector(ip1);
         } catch (ConstructionException e) {
-            Assert.assertTrue(false);
+            fail("Failed to construct host " + e.getMessage());
         }
         staticRoute.setHost(h1);
         Assert.assertEquals(h1, staticRoute.getHost());
@@ -99,11 +101,11 @@ public class StaticRouteTest {
                         ip1 = InetAddress.getByName("10.1.0.2");
                         ip2 = InetAddress.getByName("10.1.1.2");
                 } catch (UnknownHostException e) {
-                        Assert.assertTrue(false);
+                        fail("Test failed due to unknown host " + e.getMessage());
                 }
         InetAddress rxdIp1 = staticRoute1.longestPrefixMatch(ip1);
         InetAddress rxdIp2 = staticRoute1.longestPrefixMatch(ip2);
-                Assert.assertEquals(null, rxdIp1);
+                Assert.assertNull(rxdIp1);
                 Assert.assertEquals("10.1.1.0", rxdIp2.getHostAddress());
         }
 }
index ef2e0fa..b35380b 100644 (file)
@@ -1,5 +1,6 @@
 package org.opendaylight.controller.forwardingrulesmanager.internal;
 
+import static junit.framework.Assert.fail;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
 import static org.ops4j.pax.exam.CoreOptions.junitBundles;
@@ -209,7 +210,7 @@ public class ForwardingRulesManagerIT {
             Assert.assertTrue(stat.getCode() == StatusCode.SUCCESS);
         } catch (ConstructionException e) {
             // Got a failure while allocating the node
-            Assert.assertTrue(false);
+            fail("Failed while allocating the node " + e.getMessage());
         }
     }
 }
index 1e5ea0f..117b911 100644 (file)
@@ -47,14 +47,12 @@ public class TopologyTest {
         try {
             e12 = new Edge(nc12, nc21);
         } catch (ConstructionException e) {
-            logger.error("",e);
-            assertTrue(false);
+            fail("Failed to construct edge " + e.getMessage());
         }
         try {
             e23 = new Edge(nc23, nc32);
         } catch (ConstructionException e) {
-            logger.error("",e);
-            assertTrue(false);
+            fail("Failed to construct edge " + e.getMessage());
         }
 
         Set<Property> props = new HashSet<Property>();