From 4594ce9525b5f49218b1bd6af41d46af79ceb68f Mon Sep 17 00:00:00 2001 From: Kalvin Hom Date: Thu, 28 Mar 2013 13:54:29 -0700 Subject: [PATCH] JUnit test for forwarding.staticrouting.northbound Change-Id: I8c69f7e74aabfac429977087804d5e7bc182bbbc Signed-off-by: Kalvin Hom --- .../StaticRoutingNorthboundTest.java | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 opendaylight/northbound/staticrouting/src/test/java/org/opendaylight/controller/forwarding/staticrouting/northbound/StaticRoutingNorthboundTest.java 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 index 0000000000..2023d52561 --- /dev/null +++ b/opendaylight/northbound/staticrouting/src/test/java/org/opendaylight/controller/forwarding/staticrouting/northbound/StaticRoutingNorthboundTest.java @@ -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 srl = new ArrayList(); + srs.setFlowConfig(srl); + Assert.assertTrue(srs.getFlowConfig().equals(srl)); + } + +} -- 2.36.6