Separating renderers into features.
[groupbasedpolicy.git] / renderers / opflex / src / test / java / org / opendaylight / groupbasedpolicy / renderer / opflex / mit / EnumInfoTest.java
1 /*
2  * Copyright (C) 2014 Cisco Systems, Inc.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  *
8  *  Authors : tbachman
9  */
10 package org.opendaylight.groupbasedpolicy.renderer.opflex.mit;
11
12 import static org.junit.Assert.assertTrue;
13
14 import java.math.BigInteger;
15
16 import org.junit.Test;
17 import org.opendaylight.groupbasedpolicy.renderer.opflex.mit.EnumInfo.EnumInfoBuilder;
18
19 public class EnumInfoTest {
20
21         private static final String TEST_NAME_1 = "Foo";
22         private static final String TEST_NAME_2 = "Boo";
23         private static final String TEST_NAME_3 = "Zoo";
24         private static final String TEST_VALUE_1_STRING = "100";
25         private static final String TEST_VALUE_2_STRING = "101";
26         private static final String TEST_VALUE_3_STRING = "102";
27
28
29
30     @Test
31     public void testBuilder() throws Exception {
32         EnumInfoBuilder eib = new EnumInfoBuilder();
33
34         BigInteger bi1 = new BigInteger(TEST_VALUE_1_STRING);
35         BigInteger bi2 = new BigInteger(TEST_VALUE_2_STRING);
36         BigInteger bi3 = new BigInteger(TEST_VALUE_3_STRING);
37
38         eib.setEnumValue(TEST_NAME_1, bi1);
39         eib.setEnumValue(TEST_NAME_2, bi2);
40         eib.setEnumValue(TEST_NAME_3, bi3);
41
42         EnumInfo ei = eib.build();
43         assertTrue(ei.getEnumValue(TEST_NAME_1).equals(bi1));
44         assertTrue(ei.getEnumValue(bi1).equals(TEST_NAME_1));
45         assertTrue(ei.getEnumValue(TEST_NAME_2).equals(bi2));
46         assertTrue(ei.getEnumValue(bi2).equals(TEST_NAME_2));
47         assertTrue(ei.getEnumValue(TEST_NAME_3).equals(bi3));
48         assertTrue(ei.getEnumValue(bi3).equals(TEST_NAME_3));
49     }
50
51 }