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