4dd4f2766030d9712584530ae06f56fad3170553
[mdsal.git] / binding / mdsal-binding-generator-util / src / test / java / org / opendaylight / mdsal / binding / model / util / BindingTypesTest.java
1 /*
2  * Copyright (c) 2013 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 package org.opendaylight.mdsal.binding.model.util;
9
10 import static org.junit.Assert.assertEquals;
11 import static org.junit.Assert.assertNotNull;
12 import static org.opendaylight.mdsal.binding.model.util.Types.typeForClass;
13
14 import org.junit.Test;
15 import org.opendaylight.yangtools.yang.binding.Augmentable;
16 import org.opendaylight.yangtools.yang.binding.Augmentation;
17 import org.opendaylight.yangtools.yang.binding.BaseIdentity;
18 import org.opendaylight.yangtools.yang.binding.DataObject;
19 import org.opendaylight.yangtools.yang.binding.DataRoot;
20 import org.opendaylight.yangtools.yang.binding.Identifiable;
21 import org.opendaylight.yangtools.yang.binding.Identifier;
22 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
23 import org.opendaylight.yangtools.yang.binding.Notification;
24 import org.opendaylight.yangtools.yang.binding.NotificationListener;
25 import org.opendaylight.yangtools.yang.binding.RpcService;
26
27 public class BindingTypesTest {
28
29     @Test
30     public void staticBindingTypesTest() {
31         assertEquals("AUGMENTABLE", typeForClass(Augmentable.class), BindingTypes.AUGMENTABLE);
32         assertEquals("AUGMENTATION", typeForClass(Augmentation.class), BindingTypes.AUGMENTATION);
33         assertEquals("BASE_IDENTITY", typeForClass(BaseIdentity.class), BindingTypes.BASE_IDENTITY);
34         assertEquals("DATA_OBJECT", typeForClass(DataObject.class), BindingTypes.DATA_OBJECT);
35         assertEquals("DATA_ROOT", typeForClass(DataRoot.class), BindingTypes.DATA_ROOT);
36         assertEquals("IDENTIFIABLE", typeForClass(Identifiable.class), BindingTypes.IDENTIFIABLE);
37         assertEquals("IDENTIFIER", typeForClass(Identifier.class), BindingTypes.IDENTIFIER);
38         assertEquals("INSTANCE_IDENTIFIER", typeForClass(InstanceIdentifier.class), BindingTypes.INSTANCE_IDENTIFIER);
39         assertEquals("NOTIFICATION", typeForClass(Notification.class), BindingTypes.NOTIFICATION);
40         assertEquals("NOTIFICATION_LISTENER", typeForClass(NotificationListener.class), BindingTypes.NOTIFICATION_LISTENER);
41         assertEquals("RPC_SERVICE", typeForClass(RpcService.class), BindingTypes.RPC_SERVICE);
42     }
43
44     @Test(expected = NullPointerException.class)
45     public void testAugmentableNull() {
46         BindingTypes.augmentable(null);
47     }
48
49     @Test(expected = NullPointerException.class)
50     public void testChildOfNull() {
51         BindingTypes.childOf(null);
52     }
53
54     @Test
55     public void testAugmentable() {
56         assertNotNull(BindingTypes.augmentable(Types.objectType()));
57     }
58
59     @Test
60     public void testChildOf() {
61         assertNotNull(BindingTypes.childOf(Types.objectType()));
62     }
63 }