@Test public void testWithGenericType() { val arrayDequeCallable = Type.of("java.util.ArrayDeque").withTypeArgument(Type.of("java.util.Callable")); assertEquals("java.util.ArrayDeque", arrayDequeCallable.getClassName()); assertEquals("java.util.Callable", arrayDequeCallable.getTypeArguments().get(0).getClassName()); }
@Test public void testPrimitiveParameter() throws Exception { Type typeParameter = new Type("Z", null); assertFalse(typeParameter.isClassType()); assertFalse(typeParameter.isTypeParameter()); assertTrue(typeParameter.isPrimitiveType()); assertEquals("boolean", typeParameter.getPrimitiveTypeName()); }
@Test public void testClassParameter() throws Exception { Type typeParameter = new Type("Ljava/lang/Object;", null); assertTrue(typeParameter.isClassType()); assertFalse(typeParameter.isTypeParameter()); assertFalse(typeParameter.isPrimitiveType()); assertEquals("java.lang.Object", typeParameter.getClassName()); }
private void testOf(String in, String expected) { Assert.assertEquals(expected, Type.of(in).descriptor); }