GenericsUtil { @SuppressWarnings("rawtypes") public static <T> Class[] resolveParameterizedClass(Class<T> genericClass, Class<? extends T> descendantClass) throws IllegalArgumentException, IllegalStateException { if (genericClass == null) { throw new IllegalArgumentException("Argument 'genericsClass' (" + Class.class.getName() + ") is null"); } if (descendantClass == null) { throw new IllegalArgumentException("Argument 'descendantClass'(" + Class.class.getName() + ") is null"); } List<ParameterizedType> ancestorTypeList = getAncestorTypeList( genericClass, descendantClass); ParameterizedType parameterizedType = ancestorTypeList.get( ancestorTypeList.size() - 1); Type[] actualTypes = parameterizedType.getActualTypeArguments(); Class[] actualClasses = new Class[actualTypes.length]; for (int i = 0; i < actualTypes.length; i++) { actualClasses[i] = resolveTypeVariable(actualTypes[i], ancestorTypeList); } return actualClasses; }  @SuppressWarnings("rawtypes") static Class[] resolveParameterizedClass(Class<T> genericClass,
            Class<? extends T> descendantClass); static Class<? extends Object> resolveParameterizedClass(
            Class<T> genericClass, Class<? extends T> descendantClass,
            int index);  }
@Test public void testResolveParameterizedClassClassClass01() throws Exception { try { GenericsUtil.resolveParameterizedClass(null, null); fail("例外がスローされませんでした。"); } catch (IllegalArgumentException e) { assertEquals("Argument 'genericsClass' (" + Class.class.getName() + ") is null", e.getMessage()); assertEquals(IllegalArgumentException.class.getName(), e.getClass() .getName()); } }
@Test public void testResolveParameterizedClassClassClass02() throws Exception { try { GenericsUtil.resolveParameterizedClass(Object.class, null); fail("例外がスローされませんでした。"); } catch (IllegalArgumentException e) { assertEquals("Argument 'descendantClass'(" + Class.class.getName() + ") is null", e.getMessage()); assertEquals(IllegalArgumentException.class.getName(), e.getClass() .getName()); } }
@Test public void testResolveParameterizedClassClassClass03() throws Exception { try { GenericsUtil.resolveParameterizedClass(Object.class, String.class); fail("例外がスローされませんでした。"); } catch (IllegalStateException e) { assertEquals(IllegalStateException.class.getName(), e.getClass() .getName()); } }
@Test public void testResolveParameterizedClassClassClass04() throws Exception { try { GenericsUtil.resolveParameterizedClass(FutureTask.class, GenericsUtil_FutureTaskStub01.class); fail("例外がスローされませんでした。"); } catch (IllegalStateException e) { assertEquals(IllegalStateException.class.getName(), e.getClass() .getName()); } }
@Test public void testResolveParameterizedClassClassClass05() throws Exception { @SuppressWarnings("rawtypes") Class[] result = GenericsUtil.resolveParameterizedClass( FutureTask.class, GenericsUtil_FutureTaskStub02.class); assertNotNull(result); assertEquals(1, result.length); assertEquals(String.class, result[0]); }
@Test public void testResolveParameterizedClassClassClass06() throws Exception { @SuppressWarnings("rawtypes") Class[] result = GenericsUtil.resolveParameterizedClass( FutureTask.class, GenericsUtil_FutureTaskStub03.class); assertNotNull(result); assertEquals(1, result.length); assertEquals(Map.class, result[0]); }
@Test public void testResolveParameterizedClassClassClass07() throws Exception { @SuppressWarnings("rawtypes") Class[] result = GenericsUtil.resolveParameterizedClass( GenericsUtil_Stub01.class, GenericsUtil_Stub02.class); assertNotNull(result); assertEquals(3, result.length); assertEquals(String[].class, result[0]); assertEquals(Integer.class, result[1]); assertEquals(Boolean.class, result[2]); }
@Test public void testResolveParameterizedClassClassClass08() throws Exception { @SuppressWarnings("rawtypes") Class[] result = GenericsUtil.resolveParameterizedClass( GenericsUtil_Stub03.class, GenericsUtil_Stub04.class); assertNotNull(result); assertEquals(3, result.length); assertEquals(String[].class, result[0]); assertEquals(Integer.class, result[1]); assertEquals(Boolean.class, result[2]); }
@Test public void testResolveParameterizedClassClassClass09() throws Exception { @SuppressWarnings("rawtypes") Class[] result = GenericsUtil.resolveParameterizedClass( GenericsUtil_Stub03.class, GenericsUtil_Stub06.class); assertNotNull(result); assertEquals(3, result.length); assertEquals(String[].class, result[0]); assertEquals(Integer.class, result[1]); assertEquals(Boolean.class, result[2]); }
@Test public void testResolveParameterizedClassClassClass10() throws Exception { @SuppressWarnings("rawtypes") Class[] result = GenericsUtil.resolveParameterizedClass( GenericsUtil_Stub03.class, GenericsUtil_Stub07.class); assertNotNull(result); assertEquals(3, result.length); assertEquals(String[].class, result[0]); assertEquals(Integer.class, result[1]); assertEquals(Boolean.class, result[2]); }
@Test public void testResolveParameterizedClassClassClass11() throws Exception { @SuppressWarnings("rawtypes") Class[] result = GenericsUtil.resolveParameterizedClass( GenericsUtil_Stub03.class, GenericsUtil_Stub09.class); assertNotNull(result); assertEquals(3, result.length); assertEquals(Boolean.class, result[0]); assertEquals(String[].class, result[1]); assertEquals(Integer.class, result[2]); }
@Test public void testResolveParameterizedClassClassClassint01() throws Exception { try { GenericsUtil.resolveParameterizedClass(null, null, 0); fail("例外がスローされませんでした。"); } catch (IllegalArgumentException e) { assertEquals("Argument 'genericsClass' (" + Class.class.getName() + ") is null", e.getMessage()); assertEquals(IllegalArgumentException.class.getName(), e.getClass() .getName()); } }
@Test public void testResolveParameterizedClassClassClassint02() throws Exception { try { GenericsUtil.resolveParameterizedClass(Object.class, null, 0); fail("例外がスローされませんでした。"); } catch (IllegalArgumentException e) { assertEquals("Argument 'descendantClass'(" + Class.class.getName() + ") is null", e.getMessage()); assertEquals(IllegalArgumentException.class.getName(), e.getClass() .getName()); } }
@Test public void testResolveParameterizedClassClassClassint03() throws Exception { try { GenericsUtil.resolveParameterizedClass(Object.class, String.class, 0); fail("例外がスローされませんでした。"); } catch (IllegalStateException e) { assertEquals(IllegalStateException.class.getName(), e.getClass() .getName()); } }
@Test public void testResolveParameterizedClassClassClassint04() throws Exception { try { GenericsUtil.resolveParameterizedClass(FutureTask.class, GenericsUtil_FutureTaskStub01.class, 0); fail("例外がスローされませんでした。"); } catch (IllegalStateException e) { assertEquals(IllegalStateException.class.getName(), e.getClass() .getName()); } }
@Test public void testResolveParameterizedClassClassClassint05() throws Exception { Class<?> result = GenericsUtil.resolveParameterizedClass( FutureTask.class, GenericsUtil_FutureTaskStub02.class, 0); assertEquals(String.class, result); }
@Test public void testResolveParameterizedClassClassClassint06() throws Exception { Class<?> result = GenericsUtil.resolveParameterizedClass( FutureTask.class, GenericsUtil_FutureTaskStub03.class, 0); assertEquals(Map.class, result); }
@Test public void testResolveParameterizedClassClassClassint07() throws Exception { try { GenericsUtil.resolveParameterizedClass(FutureTask.class, GenericsUtil_FutureTaskStub02.class, -1); } catch (IllegalArgumentException e) { assertEquals("Argument 'index'(-1) is out of bounds of " + "generics parameters", e.getMessage()); assertEquals(IllegalArgumentException.class.getName(), e.getClass() .getName()); } }
@Test public void testResolveParameterizedClassClassClassint08() throws Exception { try { GenericsUtil.resolveParameterizedClass(FutureTask.class, GenericsUtil_FutureTaskStub03.class, 1); } catch (IllegalArgumentException e) { assertEquals("Argument 'index'(1) is out of bounds of " + "generics parameters", e.getMessage()); assertEquals(IllegalArgumentException.class.getName(), e.getClass() .getName()); } }
@Test public void testResolveParameterizedClassClassClassint09() throws Exception { Class<?> result = GenericsUtil.resolveParameterizedClass( GenericsUtil_Stub01.class, GenericsUtil_Stub02.class, 0); assertEquals(String[].class, result); }
@Test public void testResolveParameterizedClassClassClassint10() throws Exception { Class<?> result = GenericsUtil.resolveParameterizedClass( GenericsUtil_Stub03.class, GenericsUtil_Stub04.class, 2); assertEquals(Boolean.class, result); }
@Test public void testResolveParameterizedClassClassClassint11() throws Exception { Class<?> result = GenericsUtil.resolveParameterizedClass( GenericsUtil_Stub03.class, GenericsUtil_Stub06.class, 1); assertEquals(Integer.class, result); }
@Test public void testResolveParameterizedClassClassClassint12() throws Exception { Class<?> result = GenericsUtil.resolveParameterizedClass( GenericsUtil_Stub03.class, GenericsUtil_Stub07.class, 1); assertEquals(Integer.class, result); }