blob: 3c16a140c03a7c917ee162eecb2dddbb159d9090 [file] [log] [blame]
chidambar babu344dc812016-05-02 19:13:10 +05301/*
2 * Copyright 2016-present Open Networking Laboratory
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package org.onosproject.isis.controller.impl;
17
18import org.easymock.EasyMock;
19import org.junit.After;
20import org.junit.Before;
21import org.junit.Test;
22import org.onosproject.isis.controller.IsisInterface;
23import org.onosproject.isis.controller.IsisProcess;
24
25import java.util.List;
26
27import static org.hamcrest.CoreMatchers.is;
28import static org.hamcrest.CoreMatchers.nullValue;
29import static org.junit.Assert.assertThat;
30
31/**
32 * Unit test class for DefaultIsisProcess.
33 */
34public class DefaultIsisProcessTest {
35
36 private final String processId = "1";
37 private IsisProcess isisProcess;
38 private String result;
39 private IsisInterface isisInterface;
40 private List<IsisInterface> isisInterfaceList;
41 private List<IsisInterface> result1;
42
43 @Before
44 public void setUp() throws Exception {
45 isisProcess = new DefaultIsisProcess();
46 isisInterface = EasyMock.createNiceMock(DefaultIsisInterface.class);
47 }
48
49 @After
50 public void tearDown() throws Exception {
51 isisProcess = null;
52 }
53
54 /**
55 * Tests processId() setter method.
56 */
57 @Test
58 public void testProcessId() throws Exception {
59 isisProcess.setProcessId(processId);
60 result = isisProcess.processId();
61 assertThat(result, is(processId));
62 }
63
64 /**
65 * Tests processId() getter method.
66 */
67 @Test
68 public void testSetProcessId() throws Exception {
69 isisProcess.setProcessId(processId);
70 result = isisProcess.processId();
71 assertThat(result, is(processId));
72 }
73
74 /**
75 * Tests isisInterfaceList() setter method.
76 */
77 @Test
78 public void testIsisInterfaceList() throws Exception {
79 isisProcess.setIsisInterfaceList(isisInterfaceList);
80 result1 = isisProcess.isisInterfaceList();
81 assertThat(result1, is(nullValue()));
82 }
83
84 /**
85 * Tests isisInterfaceList() getter method.
86 */
87 @Test
88 public void testSetIsisInterfaceList() throws Exception {
89 isisProcess.setIsisInterfaceList(isisInterfaceList);
90 result1 = isisProcess.isisInterfaceList();
91 assertThat(result1, is(nullValue()));
92 }
93}