Add renderer test files
[nemo.git] / nemo-renderers / openflow-renderer / src / test / java / org.opendaylight / nemo.renderer.openflow / entity / HostBeanTest.java
1 package org.opendaylight.nemo.renderer.openflow.entity;
2
3 import junit.framework.TestCase;
4 import org.junit.Assert;
5 import org.junit.Before;
6 import org.junit.Test;
7 import org.opendaylight.nemo.renderer.openflow.entity.HostBean;
8 import java.util.LinkedList;
9 import static org.mockito.Mockito.*;
10 import java.util.List;
11
12 import static org.junit.Assert.*;
13
14 /**
15  * Created by zhangmeng on 2015/11/8.
16  */
17 public class HostBeanTest extends TestCase {
18
19     private HostBean hostBean;
20     private String hostName;
21     private List<String>  IPAddressList;
22     private String macAddress;
23     private String nodeID;
24     private String connectorID;
25     @Before
26     public void setUp() throws Exception {
27         hostBean = new HostBean();
28         hostName = null;
29         IPAddressList = new LinkedList<String>();
30         macAddress = null;
31         nodeID = null;
32         connectorID = null;
33     }
34
35     @Test
36     public void testGetHostName() throws Exception {
37         Assert.assertNull(hostBean.getHostName());
38         hostName = "test";
39         hostBean.setHostName(hostName);
40         Assert.assertEquals("test",hostBean.getHostName());
41         hostName = null;
42     }
43
44     @Test
45     public void testSetHostName() throws Exception {
46         Assert.assertNull(hostBean.getHostName());
47         hostName = "test";
48         hostBean.setHostName(hostName);
49         Assert.assertEquals("test",hostBean.getHostName());
50     }
51
52     @Test
53     public void testGetIPAddressList() throws Exception {
54         Assert.assertNull(hostBean.getIPAddressList());
55         IPAddressList.add("test");
56         hostBean.setStringList(IPAddressList);
57         Assert.assertNotNull(hostBean.getIPAddressList());
58         IPAddressList.clear();
59     }
60
61     @Test
62     public void testSetStringList() throws Exception {
63         Assert.assertNull(hostBean.getIPAddressList());
64         IPAddressList.add("test");
65         hostBean.setStringList(IPAddressList);
66         Assert.assertNotNull(hostBean.getIPAddressList());
67     }
68
69     @Test
70     public void testGetMacAddress() throws Exception {
71         Assert.assertNull(hostBean.getMacAddress());
72         macAddress = "test";
73         hostBean.setMacAddress(macAddress);
74         Assert.assertEquals("test",hostBean.getMacAddress());
75         macAddress = null;
76     }
77
78     @Test
79     public void testSetMacAddress() throws Exception {
80         Assert.assertNull(hostBean.getMacAddress());
81         macAddress = "test";
82         hostBean.setMacAddress(macAddress);
83         Assert.assertEquals("test",hostBean.getMacAddress());
84     }
85
86     @Test
87     public void testGetNodeID() throws Exception {
88         Assert.assertNull(hostBean.getNodeID());
89         nodeID = "test";
90         hostBean.setNodeID(nodeID);
91         Assert.assertEquals("test",hostBean.getNodeID());
92         nodeID = null;
93     }
94
95     @Test
96     public void testSetNodeID() throws Exception {
97         Assert.assertNull(hostBean.getNodeID());
98         nodeID = "test";
99         hostBean.setNodeID(nodeID);
100         Assert.assertEquals("test",hostBean.getNodeID());
101     }
102
103     @Test
104     public void testGetConnectorID() throws Exception {
105         Assert.assertNull(hostBean.getConnectorID());
106         connectorID = "test";
107         hostBean.setConnectorID(connectorID);
108         Assert.assertEquals("test",hostBean.getConnectorID());
109         connectorID = null;
110     }
111
112     @Test
113     public void testSetConnectorID() throws Exception {
114         Assert.assertNull(hostBean.getConnectorID());
115         connectorID = "test";
116         hostBean.setConnectorID(connectorID);
117         Assert.assertEquals("test",hostBean.getConnectorID());
118     }
119 }