Rework DataObjectSerializer implementations
[mdsal.git] / binding / mdsal-binding-generator-impl / src / test / java / org / opendaylight / mdsal / binding / generator / util / JavassistUtilsTest.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.util;
9
10 import static org.junit.Assert.assertFalse;
11 import static org.junit.Assert.assertNotNull;
12 import static org.mockito.ArgumentMatchers.any;
13 import static org.mockito.Mockito.doNothing;
14 import static org.mockito.Mockito.mock;
15
16 import javassist.CannotCompileException;
17 import javassist.ClassPool;
18 import javassist.NotFoundException;
19 import org.junit.Test;
20
21 @Deprecated
22 public class JavassistUtilsTest {
23
24     @Test
25     public void forClassPool() throws CannotCompileException, NotFoundException {
26         final JavassistUtils javassistUtils = JavassistUtils.forClassPool(ClassPool.getDefault());
27         final ClassGenerator classGenerator = mock(ClassGenerator.class);
28         doNothing().when(classGenerator).process(any());
29
30         final ClassCustomizer classCustomizer = mock(ClassCustomizer.class);
31         doNothing().when(classCustomizer).customizeClass(any());
32         assertNotNull(javassistUtils.instantiatePrototype("javassist.CtNewClass", "leWut", classCustomizer));
33     }
34
35     @Test
36     public void privateConstructTest() throws Exception {
37         assertFalse(JavassistUtils.class.getDeclaredConstructor(ClassPool.class).isAccessible());
38     }
39 }