9a5452aa6caa237cc702d1b81b8b388d4520cfd0
[controller.git] / opendaylight / config / config-manager / src / test / java / org / opendaylight / controller / config / manager / impl / util / InterfacesHelperTest.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.controller.config.manager.impl.util;
9
10 import static org.junit.Assert.assertEquals;
11
12 import java.util.Set;
13
14 import javax.management.MXBean;
15
16 import org.junit.Test;
17 import org.opendaylight.controller.config.spi.Module;
18 import org.opendaylight.yangtools.concepts.Identifiable;
19
20 import com.google.common.collect.Sets;
21
22 public class InterfacesHelperTest {
23
24     interface SuperA {
25
26     }
27
28     interface SuperBMXBean {
29
30     }
31
32     interface SuperC extends SuperA, SuperBMXBean {
33
34     }
35
36     class SuperClass implements SuperC {
37
38     }
39
40     @MXBean
41     interface SubA {
42
43     }
44
45     abstract class SubClass extends SuperClass implements SubA, Module {
46
47     }
48
49     @Test
50     public void testGetAllInterfaces() {
51         Set<Class<?>> expected = Sets.<Class<?>> newHashSet(SuperA.class, SuperBMXBean.class, SuperC.class,
52                 SubA.class, Identifiable.class, Module.class);
53         assertEquals(expected,
54                 InterfacesHelper.getAllInterfaces(SubClass.class));
55     }
56
57     @Test
58     public void testGetMXInterfaces() {
59         Set<Class<?>> expected = Sets.<Class<?>> newHashSet(SuperBMXBean.class, SubA.class);
60         assertEquals(expected, InterfacesHelper.getMXInterfaces(SubClass.class));
61     }
62
63 }