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 25b2dacde10656cba2475775136265d85817fc18..ee0e9dc8787f15770a835ec2ce25b5ca1a5eae87 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 org.opendaylight.controller.sal.utils.NodeConnectorCreator;
 import org.opendaylight.controller.sal.utils.NodeCreator;
 
+import static junit.framework.Assert.fail;
+
 public class StaticRouteTest {
 
         @Test
 public class StaticRouteTest {
 
         @Test
@@ -36,7 +38,7 @@ public class StaticRouteTest {
                         nextHopAddress = InetAddress.getByName("200.0.0.1");
 
                 } catch (UnknownHostException e) {
                         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());
                 }
                 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) {
         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) {
         }
         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());
         }
         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) {
                         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);
                 }
         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());
         }
 }
                 Assert.assertEquals("10.1.1.0", rxdIp2.getHostAddress());
         }
 }
index ef2e0fa01d3b14c98fa1fe51bdf4f9168e5f4f60..b35380b46749a98009f365ef027c7610764f4fd0 100644 (file)
@@ -1,5 +1,6 @@
 package org.opendaylight.controller.forwardingrulesmanager.internal;
 
 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;
 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(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 1e5ea0f2c576ac1b0e6b34e605f10b3f8841a9ad..117b911f36f3c00ad67291edc81dc313d7c209dd 100644 (file)
@@ -47,14 +47,12 @@ public class TopologyTest {
         try {
             e12 = new Edge(nc12, nc21);
         } catch (ConstructionException e) {
         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) {
         }
         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>();
         }
 
         Set<Property> props = new HashSet<Property>();