Tests for iovisor.sf
[groupbasedpolicy.git] / renderers / iovisor / src / test / java / org / opendaylight / groupbasedpolicy / renderer / iovisor / sf / ClassificationResultTest.java
1 /*\r
2  * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.\r
3  *\r
4  * This program and the accompanying materials are made available under the\r
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
6  * and is available at http://www.eclipse.org/legal/epl-v10.html\r
7  */\r
8 \r
9 package org.opendaylight.groupbasedpolicy.renderer.iovisor.sf;\r
10 \r
11 import static org.junit.Assert.assertEquals;\r
12 import static org.junit.Assert.assertFalse;\r
13 import static org.junit.Assert.assertTrue;\r
14 \r
15 import java.util.ArrayList;\r
16 import java.util.List;\r
17 \r
18 import org.junit.Before;\r
19 import org.junit.Test;\r
20 \r
21 public class ClassificationResultTest {\r
22 \r
23     private static final String ERROR_MESSAGE = "error message";\r
24     private ClassificationResult resultOk;\r
25     private ClassificationResult resultError;\r
26 \r
27     @Before\r
28     public void init() {\r
29         List<String> list = new ArrayList<>();\r
30         list.add("string");\r
31         resultOk = new ClassificationResult(list);\r
32         resultError = new ClassificationResult(ERROR_MESSAGE);\r
33     }\r
34 \r
35     @Test\r
36     public void testConstructor_Result() {\r
37         assertTrue(resultOk.isSuccessfull());\r
38     }\r
39 \r
40     @Test\r
41     public void testConstructor_ErrorMsg() {\r
42         assertFalse(resultError.isSuccessfull());\r
43     }\r
44 \r
45     @Test\r
46     public void testGetErrorMessage() {\r
47         assertEquals(resultOk.getErrorMessage(), ClassificationResult.DEFAULT_ERROR_MESSAGE);\r
48         assertEquals(resultError.getErrorMessage(), ERROR_MESSAGE);\r
49     }\r
50 \r
51 }\r