blob: 6f078f1813d56eae52eb9ebc5d840790e71265fa [file] [log] [blame]
Kalyankumar Asangi19f64492016-02-17 17:34:16 +05301/*
2 * Copyright 2016 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.ospf.controller.area;
17
18import org.junit.After;
19import org.junit.Before;
20import org.junit.Test;
21import org.onosproject.ospf.controller.OspfProcess;
22
23import java.util.ArrayList;
24import java.util.List;
25
26import static org.hamcrest.CoreMatchers.is;
27import static org.hamcrest.CoreMatchers.notNullValue;
28import static org.hamcrest.MatcherAssert.assertThat;
29
30/**
31 * Unit test class for Configuration.
32 */
33public class ConfigurationTest {
34 private Configuration configuration;
35 private List<OspfProcess> ospfProcesses;
36 private List result;
37 private OspfProcessImpl ospfProcessImpl;
38
39 @Before
40 public void setUp() throws Exception {
41 configuration = new Configuration();
42 }
43
44 @After
45 public void tearDown() throws Exception {
46 configuration = null;
47 ospfProcessImpl = new OspfProcessImpl();
48 result = null;
49 ospfProcesses = null;
50 }
51
52 /**
53 * Tests getProcesses() getter method.
54 */
55 @Test
56 public void testGetOspfProcess() throws Exception {
57 ospfProcesses = new ArrayList();
58 ospfProcesses.add(ospfProcessImpl);
59 ospfProcesses.add(ospfProcessImpl);
60 configuration.setProcesses(ospfProcesses);
61 result = configuration.getProcesses();
62 assertThat(result.size(), is(2));
63 }
64
65 /**
66 * Tests setProcesses() setter method.
67 */
68 @Test
69 public void testSetOspfProcess() throws Exception {
70 ospfProcesses = new ArrayList();
71 ospfProcesses.add(ospfProcessImpl);
72 ospfProcesses.add(ospfProcessImpl);
73 configuration.setProcesses(ospfProcesses);
74 result = configuration.getProcesses();
75 assertThat(result.size(), is(2));
76 }
77
78 /**
79 * Tests getMethod() getter method.
80 */
81 @Test
82 public void testGetMethod() throws Exception {
83 configuration.setMethod("method");
84 assertThat(configuration.getMethod(), is("method"));
85 }
86
87 /**
88 * Tests setMethod() setter method.
89 */
90 @Test
91 public void testSetMethod() throws Exception {
92 configuration.setMethod("method");
93 assertThat(configuration.getMethod(), is("method"));
94 }
95
96 /**
97 * Tests to string method.
98 */
99 @Test
100 public void testToString() throws Exception {
101 assertThat(configuration.toString(), is(notNullValue()));
102 }
103}