Merge "JUnit Test for Topology Northbound"
[controller.git] / opendaylight / northbound / staticrouting / src / test / java / org / opendaylight / controller / forwarding / staticrouting / northbound / StaticRoutingNorthboundTest.java
1 package org.opendaylight.controller.forwarding.staticrouting.northbound;
2
3 import java.util.ArrayList;
4 import java.util.List;
5
6 import org.junit.Assert;
7 import org.junit.Test;
8
9 import junit.framework.TestCase;
10
11 public class StaticRoutingNorthboundTest extends TestCase {
12
13     @Test
14     public void testStaticRoute() {
15         StaticRoute sr = new StaticRoute();
16         Assert.assertTrue(sr.getName() == null);
17         Assert.assertTrue(sr.getPrefix() == null);
18         Assert.assertTrue(sr.getNextHop() == null);
19
20         sr = new StaticRoute("Static Route 1", "192.168.100.0/24", "170.0.0.1");
21         Assert.assertTrue(sr.getName().equals("Static Route 1"));
22         Assert.assertTrue(sr.getPrefix().equals("192.168.100.0/24"));
23         Assert.assertTrue(sr.getNextHop().equals("170.0.0.1"));
24
25         sr.setName("Static Route 2");
26         Assert.assertTrue(sr.getName().equals("Static Route 2"));
27         sr.setPrefix("192.168.100.0/26");
28         Assert.assertTrue(sr.getPrefix().equals("192.168.100.0/26"));
29         sr.setNextHop("170.0.2.1");
30         Assert.assertTrue(sr.getNextHop().equals("170.0.2.1"));
31     }
32
33     @Test
34     public void testStaticRoutes() {
35         StaticRoutes srs = new StaticRoutes(null);
36         Assert.assertTrue(srs.getFlowConfig() == null);
37
38         List<StaticRoute> srl = new ArrayList<StaticRoute>();
39         srs.setFlowConfig(srl);
40         Assert.assertTrue(srs.getFlowConfig().equals(srl));
41     }
42
43 }