Improve RpcRoutingStrategyTest
[mdsal.git] / binding / mdsal-binding-generator-impl / src / test / java / org / opendaylight / mdsal / binding / generator / impl / CodecTypeUtilsTest.java
1 /*
2  * Copyright (c) 2016 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.generator.impl;
9
10 import static org.junit.Assert.assertNotNull;
11 import static org.junit.Assert.assertTrue;
12 import static org.junit.Assert.fail;
13 import static org.mockito.Mockito.mock;
14
15 import java.lang.reflect.Constructor;
16 import java.lang.reflect.InvocationTargetException;
17 import org.junit.Test;
18 import org.opendaylight.yangtools.yang.binding.Identifiable;
19 import org.opendaylight.yangtools.yang.binding.Identifier;
20
21 public class CodecTypeUtilsTest {
22
23     @Test
24     public void newIdentifiableItem() {
25         assertNotNull(CodecTypeUtils.newIdentifiableItem(Identifiable.class, mock(Identifier.class)));
26     }
27
28     @Test
29     public void privateConstructTest() throws NoSuchMethodException, ReflectiveOperationException {
30         final Constructor<?> constructor = CodecTypeUtils.class.getDeclaredConstructor();
31         constructor.setAccessible(true);
32         try {
33             constructor.newInstance();
34             fail();
35         } catch (InvocationTargetException e) {
36             assertTrue(e.getCause() instanceof UnsupportedOperationException);
37         }
38     }
39 }