示例#1
0
 @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());
 }
示例#2
0
  @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());
  }
示例#3
0
  @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());
  }
示例#4
0
 private void testOf(String in, String expected) {
   Assert.assertEquals(expected, Type.of(in).descriptor);
 }