JUnit test for forwarding.staticrouting.northbound 86/86/1
authorKalvin Hom <kahom@cisco.com>
Thu, 28 Mar 2013 20:54:29 +0000 (13:54 -0700)
committerKalvin Hom <kahom@cisco.com>
Thu, 28 Mar 2013 20:54:29 +0000 (13:54 -0700)
Change-Id: I8c69f7e74aabfac429977087804d5e7bc182bbbc
Signed-off-by: Kalvin Hom <kahom@cisco.com>
opendaylight/northbound/staticrouting/src/test/java/org/opendaylight/controller/forwarding/staticrouting/northbound/StaticRoutingNorthboundTest.java [new file with mode: 0644]

diff --git a/opendaylight/northbound/staticrouting/src/test/java/org/opendaylight/controller/forwarding/staticrouting/northbound/StaticRoutingNorthboundTest.java b/opendaylight/northbound/staticrouting/src/test/java/org/opendaylight/controller/forwarding/staticrouting/northbound/StaticRoutingNorthboundTest.java
new file mode 100644 (file)
index 0000000..2023d52
--- /dev/null
@@ -0,0 +1,43 @@
+package org.opendaylight.controller.forwarding.staticrouting.northbound;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import junit.framework.TestCase;
+
+public class StaticRoutingNorthboundTest extends TestCase {
+
+    @Test
+    public void testStaticRoute() {
+        StaticRoute sr = new StaticRoute();
+        Assert.assertTrue(sr.getName() == null);
+        Assert.assertTrue(sr.getPrefix() == null);
+        Assert.assertTrue(sr.getNextHop() == null);
+
+        sr = new StaticRoute("Static Route 1", "192.168.100.0/24", "170.0.0.1");
+        Assert.assertTrue(sr.getName().equals("Static Route 1"));
+        Assert.assertTrue(sr.getPrefix().equals("192.168.100.0/24"));
+        Assert.assertTrue(sr.getNextHop().equals("170.0.0.1"));
+
+        sr.setName("Static Route 2");
+        Assert.assertTrue(sr.getName().equals("Static Route 2"));
+        sr.setPrefix("192.168.100.0/26");
+        Assert.assertTrue(sr.getPrefix().equals("192.168.100.0/26"));
+        sr.setNextHop("170.0.2.1");
+        Assert.assertTrue(sr.getNextHop().equals("170.0.2.1"));
+    }
+
+    @Test
+    public void testStaticRoutes() {
+        StaticRoutes srs = new StaticRoutes(null);
+        Assert.assertTrue(srs.getFlowConfig() == null);
+
+        List<StaticRoute> srl = new ArrayList<StaticRoute>();
+        srs.setFlowConfig(srl);
+        Assert.assertTrue(srs.getFlowConfig().equals(srl));
+    }
+
+}