1 package org.opendaylight.groupbasedpolicy.renderer.ofoverlay.statistics.flowcache;
\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
10 import org.junit.Before;
\r
11 import org.junit.Test;
\r
13 public class FlowCacheDefinitionBuilderTest {
\r
15 private static final String VALUE = "value-1";
\r
17 private FlowCacheDefinition.FlowCacheDefinitionBuilder builder;
\r
20 public void init() {
\r
21 builder = new FlowCacheDefinition.FlowCacheDefinitionBuilder();
\r
25 public void testConstructor() {
\r
26 FlowCacheDefinition.FlowCacheDefinitionBuilder b = null;
\r
28 b = new FlowCacheDefinition.FlowCacheDefinitionBuilder();
\r
29 } catch (Exception e) {
\r
30 fail("Exception thrown: " + e.getMessage());
\r
33 assertFalse(b.isLog());
\r
34 assertNotNull(b.getFilterBuilder());
\r
35 assertNotNull(b.getKeysBuilder());
\r
36 assertNotNull(b.getValue());
\r
40 public void testSetValue() {
\r
41 builder.setValue(VALUE);
\r
42 assertEquals(VALUE, builder.getValue());
\r
46 public void testSetLog() {
\r
47 builder.setLog(true);
\r
48 assertTrue(builder.isLog());
\r
52 public void testBuild() {
\r
53 builder.setValue(VALUE).setLog(true);
\r
54 FlowCacheDefinition definition = builder.build();
\r
56 assertEquals(VALUE, definition.getValue());
\r
57 assertTrue(definition.getLog());
\r
58 assertNotNull(definition.getKeys());
\r
59 assertNotNull(definition.getFilter());
\r