1 package org.opendaylight.nemo.renderer.openflow.entity;
3 import junit.framework.TestCase;
4 import org.junit.Before;
7 import java.util.LinkedList;
8 import org.opendaylight.nemo.renderer.openflow.entity.LinkBean;
9 import static org.mockito.Mockito.*;
11 import static org.junit.Assert.*;
14 * Created by zhangmeng on 2015/11/8.
16 public class LinkBeanTest extends TestCase {
17 private LinkBean linkBean;
19 private String linkID;
20 private String leftNodeID;
21 private String leftPortID;
22 private String rightPortID;
23 private String rightNodeID;
24 private String linkBandwidth;
27 public void setUp() throws Exception {
28 linkBean = new LinkBean();
29 linkID = leftNodeID = leftPortID = rightPortID = rightNodeID = linkBandwidth = null;
33 public void testGetLinkID() throws Exception {
34 Assert.assertNull(linkBean.getLinkID());
36 linkBean.setLinkID(linkID);
37 Assert.assertEquals(linkID,linkBean.getLinkID());
42 public void testSetLinkID() throws Exception {
43 Assert.assertNull(linkBean.getLinkID());
45 linkBean.setLinkID(linkID);
46 Assert.assertEquals(linkID,linkBean.getLinkID());
50 public void testGetLeftNodeID() throws Exception {
51 Assert.assertNull(linkBean.getLeftNodeID());
53 linkBean.setLeftNodeID(leftNodeID);
54 Assert.assertEquals(leftNodeID,linkBean.getLeftNodeID());
59 public void testSetLeftNodeID() throws Exception {
60 Assert.assertNull(linkBean.getLeftNodeID());
62 linkBean.setLeftNodeID(leftNodeID);
63 Assert.assertEquals(leftNodeID,linkBean.getLeftNodeID());
67 public void testGetLeftPortID() throws Exception {
68 Assert.assertNull(linkBean.getLeftPortID());
70 linkBean.setLeftPortID(leftPortID);
71 Assert.assertEquals(leftPortID,linkBean.getLeftPortID());
76 public void testSetLeftPortID() throws Exception {
77 Assert.assertNull(linkBean.getLeftPortID());
79 linkBean.setLeftPortID(leftPortID);
80 Assert.assertEquals(leftPortID,linkBean.getLeftPortID());
84 public void testGetRightNodeID() throws Exception {
85 Assert.assertNull(linkBean.getRightNodeID());
87 linkBean.setRightNodeID(rightNodeID);
88 Assert.assertEquals(rightNodeID,linkBean.getRightNodeID());
93 public void testSetRightNodeID() throws Exception {
94 Assert.assertNull(linkBean.getRightNodeID());
96 linkBean.setRightNodeID(rightNodeID);
97 Assert.assertEquals(rightNodeID,linkBean.getRightNodeID());
101 public void testGetRightPortID() throws Exception {
102 Assert.assertNull(linkBean.getRightPortID());
103 rightPortID = "test";
104 linkBean.setRightPortID(rightPortID);
105 Assert.assertEquals(rightPortID,linkBean.getRightPortID());
110 public void testSetRightPortID() throws Exception {
111 Assert.assertNull(linkBean.getRightPortID());
112 rightPortID = "test";
113 linkBean.setRightPortID(rightPortID);
114 Assert.assertEquals(rightPortID,linkBean.getRightPortID());
118 public void testGetLinkBandwidth() throws Exception {
119 Assert.assertNull(linkBean.getLinkBandwidth());
120 linkBandwidth = "test";
121 linkBean.setLinkBandwidth(linkBandwidth);
122 Assert.assertEquals(linkBandwidth,linkBean.getLinkBandwidth());
123 linkBandwidth = null;
127 public void testSetLinkBandwidth() throws Exception {
128 Assert.assertNull(linkBean.getLinkBandwidth());
129 linkBandwidth = "test";
130 linkBean.setLinkBandwidth(linkBandwidth);
131 Assert.assertEquals(linkBandwidth,linkBean.getLinkBandwidth());