Remove support for composite NotificationListener
[yangtools.git] / binding / mdsal-binding-model-ri / src / test / java / org / opendaylight / mdsal / binding / model / ri / 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.ri;
9
10 import static org.junit.Assert.assertArrayEquals;
11 import static org.junit.Assert.assertEquals;
12 import static org.junit.Assert.assertNotNull;
13 import static org.junit.Assert.assertThrows;
14 import static org.opendaylight.mdsal.binding.model.ri.Types.typeForClass;
15
16 import org.junit.Test;
17 import org.opendaylight.mdsal.binding.model.api.ParameterizedType;
18 import org.opendaylight.yangtools.yang.binding.Augmentable;
19 import org.opendaylight.yangtools.yang.binding.Augmentation;
20 import org.opendaylight.yangtools.yang.binding.BaseIdentity;
21 import org.opendaylight.yangtools.yang.binding.DataObject;
22 import org.opendaylight.yangtools.yang.binding.DataRoot;
23 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
24 import org.opendaylight.yangtools.yang.binding.Key;
25 import org.opendaylight.yangtools.yang.binding.KeyAware;
26 import org.opendaylight.yangtools.yang.binding.Notification;
27
28 public class BindingTypesTest {
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("KEY_AWARE", typeForClass(KeyAware.class), BindingTypes.KEY_AWARE);
37         assertEquals("KEY", typeForClass(Key.class), BindingTypes.KEY);
38         assertEquals("INSTANCE_IDENTIFIER", typeForClass(InstanceIdentifier.class), BindingTypes.INSTANCE_IDENTIFIER);
39     }
40
41     @Test
42     public void testAugmentableNull() {
43         assertThrows(NullPointerException.class, () -> BindingTypes.augmentable(null));
44     }
45
46     @Test
47     public void testChildOfNull() {
48         assertThrows(NullPointerException.class, () -> BindingTypes.childOf(null));
49     }
50
51     @Test
52     public void testAugmentable() {
53         ParameterizedType augmentableType = BindingTypes.augmentable(Types.objectType());
54         assertEquals("Augmentable", augmentableType.getName());
55     }
56
57     @Test
58     public void testChildOf() {
59         assertNotNull(BindingTypes.childOf(Types.objectType()));
60     }
61
62     @Test
63     public void testAugmentationNull() {
64         assertThrows(NullPointerException.class, () -> BindingTypes.augmentation(null));
65     }
66
67     @Test
68     public void testAugmentation() {
69         final ParameterizedType augmentationType = BindingTypes.augmentation(Types.objectType());
70         assertEquals("Augmentation", augmentationType.getName());
71     }
72
73     @Test
74     public void testNotificationNull() {
75         assertThrows(NullPointerException.class, () -> BindingTypes.notification(null));
76     }
77
78     @Test
79     public void testNotification() {
80         final ParameterizedType notificationType = BindingTypes.notification(Types.objectType());
81         assertEquals(Types.typeForClass(Notification.class), notificationType.getRawType());
82         assertArrayEquals(new Object[] { Types.objectType() }, notificationType.getActualTypeArguments());
83     }
84 }