fix #146
[memoization.java.git] / memoization-jcache / src / test / java / de / xn__ho_hia / memoization / jcache / JCacheMemoizeTest.java
blob2f25485f1817416e6517a19c3b0c80e5ac01dd31
1 /*
2 * This file is part of memoization.java. It is subject to the license terms in the LICENSE file found in the top-level
3 * directory of this distribution and at http://creativecommons.org/publicdomain/zero/1.0/. No part of memoization.java,
4 * including this file, may be copied, modified, propagated, or distributed except according to the terms contained
5 * in the LICENSE file.
6 */
7 package de.xn__ho_hia.memoization.jcache;
9 import java.lang.reflect.Constructor;
10 import java.lang.reflect.InvocationTargetException;
11 import java.lang.reflect.Modifier;
13 import org.junit.Assert;
14 import org.junit.Test;
16 import de.xn__ho_hia.quality.suppression.CompilerWarnings;
18 /**
21 @SuppressWarnings({ CompilerWarnings.NLS, CompilerWarnings.STATIC_METHOD })
22 public class JCacheMemoizeTest {
24 /**
25 * @throws NoSuchMethodException
26 * Reflection problemt
27 * @throws IllegalAccessException
28 * Reflection problemt
29 * @throws InvocationTargetException
30 * Reflection problemt
31 * @throws InstantiationException
32 * Reflection problemt
34 @Test
35 public void shouldDeclarePrivateConstructor()
36 throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException {
37 // given
38 final Constructor<JCacheMemoize> constructor = JCacheMemoize.class.getDeclaredConstructor();
40 // when
41 final boolean isPrivate = Modifier.isPrivate(constructor.getModifiers());
43 // then
44 Assert.assertTrue("Constructor is not private", isPrivate);
45 constructor.setAccessible(true);
46 constructor.newInstance();