blob: f20048c79dd9ef22066962dbc5db28669e8d55f9 [file] [log] [blame]
Dhruv Dhodyb5850122016-02-17 17:51:19 +05301/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2016-present Open Networking Foundation
Dhruv Dhodyb5850122016-02-17 17:51:19 +05303 *
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.ospf.controller.area;
17
18
19import org.junit.After;
20import org.junit.Before;
21import org.junit.Test;
22import org.onosproject.ospf.controller.OspfArea;
23
24import java.util.ArrayList;
25import java.util.List;
26
27import static org.hamcrest.MatcherAssert.assertThat;
28import static org.hamcrest.Matchers.is;
29import static org.hamcrest.Matchers.notNullValue;
30
31/**
32 * Unit test class for OspfProcessImpl.
33 */
34public class OspfProcessImplTest {
35
36 private OspfProcessImpl ospfProcess;
37 private List<OspfArea> list;
38 private List result;
39
40 @Before
41 public void setUp() throws Exception {
42 ospfProcess = new OspfProcessImpl();
43 }
44
45 @After
46 public void tearDown() throws Exception {
47 ospfProcess = null;
48 list = null;
49 }
50
51 /**
52 * Tests areas() getter method.
53 */
54 @Test
55 public void testGetAreas() throws Exception {
56 list = new ArrayList();
57 list.add(new OspfAreaImpl());
58 list.add(new OspfAreaImpl());
59 ospfProcess.setAreas(list);
60 result = ospfProcess.areas();
61 assertThat(result.size(), is(2));
62 }
63
64 /**
65 * Tests areas() setter method.
66 */
67 @Test
68 public void testSetAreas() throws Exception {
69 list = new ArrayList();
70 list.add(new OspfAreaImpl());
71 list.add(new OspfAreaImpl());
72 ospfProcess.setAreas(list);
73 result = ospfProcess.areas();
74 assertThat(result.size(), is(2));
75 }
76
77 /**
78 * Tests processId() getter method.
79 */
80 @Test
81 public void testGetProcessId() throws Exception {
82 ospfProcess.setProcessId("1.1.1.1");
83 assertThat(ospfProcess.processId(), is("1.1.1.1"));
84 }
85
86 /**
87 * Tests processId() setter method.
88 */
89 @Test
90 public void testSetProcessId() throws Exception {
91 ospfProcess.setProcessId("1.1.1.1");
92 assertThat(ospfProcess.processId(), is("1.1.1.1"));
93 }
94
95 /**
96 * Tests to string method.
97 */
98 @Test
99 public void testToString() throws Exception {
100 assertThat(ospfProcess.toString(), is(notNullValue()));
101 }
102}