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 org.mockito.Mock;
15 import org.mockito.MockitoAnnotations;
16 import org.junit.Before;
17 import org.junit.Test;
18 import org.opendaylight.groupbasedpolicy.renderer.opflex.mit.PolicyPropertyInfo.PolicyPropertyInfoBuilder;
20 public class PolicyPropertyInfoTest {
23 private static int TEST_PROP_NUM = 200;
24 private static int TEST_CLASS_ID = 100;
25 private static String TEST_PROP_NAME = "foobar";
26 private static PolicyPropertyInfo.PolicyPropertyId propId;
27 private static PolicyPropertyInfo.PropertyCardinality TEST_PROP_CARDINALITY =
28 PolicyPropertyInfo.PropertyCardinality.SCALAR;
29 private static PolicyPropertyInfo.PropertyType TEST_PROP_TYPE =
30 PolicyPropertyInfo.PropertyType.COMPOSITE;
32 EnumInfo mockEnumInfo;
35 public void setUp() throws Exception {
36 MockitoAnnotations.initMocks(this);
37 propId = new PolicyPropertyInfo.PolicyPropertyId(TEST_PROP_NUM);
41 public void builderTest() throws Exception {
42 PolicyPropertyInfoBuilder ppib = new PolicyPropertyInfoBuilder();
43 PolicyPropertyInfo ppi;
44 ppib.setClassId(TEST_CLASS_ID);
45 ppib.setEnumInfo(mockEnumInfo);
46 ppib.setPropCardinality(TEST_PROP_CARDINALITY);
47 ppib.setPropId(propId);
48 ppib.setPropName(TEST_PROP_NAME);
49 ppib.setType(TEST_PROP_TYPE);
51 assertTrue(ppi.getClassId() == TEST_CLASS_ID);
52 assertTrue(ppi.getEnumInfo() == mockEnumInfo);
53 assertTrue(ppi.getPropCardinality() == TEST_PROP_CARDINALITY);
54 assertTrue(ppi.getPropId() == propId);
55 assertTrue(ppi.getPropName().equals(TEST_PROP_NAME));
56 assertTrue(ppi.getType() == TEST_PROP_TYPE);