2 * Copyright (C) 2014 Cisco Systems, Inc.
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
10 package org.opendaylight.groupbasedpolicy.renderer.opflex.mit;
12 import static org.junit.Assert.assertTrue;
14 import java.math.BigInteger;
16 import org.junit.Test;
17 import org.opendaylight.groupbasedpolicy.renderer.opflex.mit.EnumInfo.EnumInfoBuilder;
19 public class EnumInfoTest {
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";
31 public void testBuilder() throws Exception {
32 EnumInfoBuilder eib = new EnumInfoBuilder();
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);
38 eib.setEnumValue(TEST_NAME_1, bi1);
39 eib.setEnumValue(TEST_NAME_2, bi2);
40 eib.setEnumValue(TEST_NAME_3, bi3);
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));