Change-Id: I61c7eca9c448f50140fd206ee4665bd2d58c0b65
Signed-off-by: Alissa Bonas <abonas@redhat.com>
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
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());
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());
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());
}
}
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;
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());
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>();