OFoverlay statistics test improvement
[groupbasedpolicy.git] / renderers / ofoverlay / src / test / java / org / opendaylight / groupbasedpolicy / renderer / ofoverlay / statistics / flowcache / FlowCacheDefinitionBuilderTest.java
1 package org.opendaylight.groupbasedpolicy.renderer.ofoverlay.statistics.flowcache;\r
2 \r
3 import static org.junit.Assert.assertEquals;\r
4 import static org.junit.Assert.assertFalse;\r
5 import static org.junit.Assert.assertNotNull;\r
6 import static org.junit.Assert.assertNull;\r
7 import static org.junit.Assert.assertTrue;\r
8 import static org.junit.Assert.fail;\r
9 \r
10 import org.junit.Before;\r
11 import org.junit.Test;\r
12 \r
13 public class FlowCacheDefinitionBuilderTest {\r
14 \r
15     private static final String VALUE = "value-1";\r
16 \r
17     private FlowCacheDefinition.FlowCacheDefinitionBuilder builder;\r
18 \r
19     @Before\r
20     public void init() {\r
21         builder = new FlowCacheDefinition.FlowCacheDefinitionBuilder();\r
22     }\r
23 \r
24     @Test\r
25     public void testConstructor() {\r
26         FlowCacheDefinition.FlowCacheDefinitionBuilder b = null;\r
27         try {\r
28             b = new FlowCacheDefinition.FlowCacheDefinitionBuilder();\r
29         } catch (Exception e) {\r
30             fail("Exception thrown: " + e.getMessage());\r
31         }\r
32         assertNotNull(b);\r
33         assertFalse(b.isLog());\r
34         assertNotNull(b.getFilterBuilder());\r
35         assertNotNull(b.getKeysBuilder());\r
36         assertNotNull(b.getValue());\r
37     }\r
38 \r
39     @Test\r
40     public void testSetValue() {\r
41         builder.setValue(VALUE);\r
42         assertEquals(VALUE, builder.getValue());\r
43     }\r
44 \r
45     @Test\r
46     public void testSetLog() {\r
47         builder.setLog(true);\r
48         assertTrue(builder.isLog());\r
49     }\r
50 \r
51     @Test\r
52     public void testBuild() {\r
53         builder.setValue(VALUE).setLog(true);\r
54         FlowCacheDefinition definition = builder.build();\r
55 \r
56         assertEquals(VALUE, definition.getValue());\r
57         assertTrue(definition.getLog());\r
58         assertNotNull(definition.getKeys());\r
59         assertNotNull(definition.getFilter());\r
60     }\r
61 \r
62 }\r