e210b8eff97df29483e262e163b4d632977a73d8
[groupbasedpolicy.git] / groupbasedpolicy / src / test / java / org / opendaylight / groupbasedpolicy / resolver / validator / validators / TenantValidatorTest.java
1 /*
2  * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
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
9 package org.opendaylight.groupbasedpolicy.resolver.validator.validators;
10
11 import static org.mockito.Mockito.mock;
12 import static org.mockito.Mockito.when;
13
14 import java.util.List;
15
16 import org.junit.Assert;
17 import org.junit.Before;
18 import org.junit.Test;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.tenants.Tenant;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.policy.rev140421.tenants.tenant.SubjectFeatureInstances;
21 import org.opendaylight.yangtools.yang.binding.ChildOf;
22
23 public class TenantValidatorTest {
24
25     private TenantValidator validator;
26
27     @Before
28     public void initialise() {
29         validator = new TenantValidator();
30     }
31
32     @Test
33     public void getChildObjectsTest() {
34         Tenant objectToValidate = mock(Tenant.class);
35         SubjectFeatureInstances subjectFeatureInstances = mock(SubjectFeatureInstances.class);
36         when(objectToValidate.getSubjectFeatureInstances()).thenReturn(subjectFeatureInstances);
37         List<ChildOf<Tenant>> childObjects = validator.getChildObjects(objectToValidate);
38         Assert.assertTrue(childObjects.contains(subjectFeatureInstances));
39     }
40
41     @Test
42     public void getTypeTest() {
43         Assert.assertEquals(Tenant.class, validator.getType());
44     }
45 }