Added range type to subject-feature-definition/parameter
[groupbasedpolicy.git] / groupbasedpolicy / src / test / java / org / opendaylight / groupbasedpolicy / renderer / opflex / mit / PolicyPropertyInfoTest.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 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;
19
20 public class PolicyPropertyInfoTest {
21
22
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;
31         @Mock
32         EnumInfo mockEnumInfo;
33
34     @Before
35     public void setUp() throws Exception {
36         MockitoAnnotations.initMocks(this);
37         propId = new PolicyPropertyInfo.PolicyPropertyId(TEST_PROP_NUM);
38     }
39
40     @Test
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);
50         ppi = ppib.build();
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);
57
58     }
59
60 }