Bug 6859 #2 Binding generator v1 refactoring
[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.mockito.Mockito.mock;
12
13 import java.lang.reflect.Constructor;
14 import org.junit.Test;
15 import org.opendaylight.mdsal.binding.generator.impl.CodecTypeUtils;
16 import org.opendaylight.yangtools.yang.binding.Identifiable;
17 import org.opendaylight.yangtools.yang.binding.Identifier;
18
19 public class CodecTypeUtilsTest {
20
21     @Test
22     public void newIdentifiableItem() throws Exception {
23         assertNotNull(CodecTypeUtils.newIdentifiableItem(Identifiable.class, mock(Identifier.class)));
24     }
25
26     @Test(expected = UnsupportedOperationException.class)
27     public void privateConstructTest() throws Throwable {
28         final Constructor constructor = CodecTypeUtils.class.getDeclaredConstructor();
29         constructor.setAccessible(true);
30         try {
31             constructor.newInstance();
32         } catch (Exception e) {
33             throw e.getCause();
34         }
35     }
36 }