DATypeFactory { @Nonnull public static DAType declared(@Nonnull String qualifiedName) { return declared(qualifiedName, Collections.<DAType>emptyList()); } private  DATypeFactory(); @Nonnull static DAType voidDaType(); @Nonnull static DAType from(@Nonnull Class<?> clazz); @Nonnull static DAType from(@Nonnull Class<?> clazz, @Nonnull List<DAType> typeArgs); @Nonnull static DAType declared(@Nonnull String qualifiedName); @Nonnull static DAType declared(@Nonnull String qualifiedName, @Nonnull List<DAType> typeArgs); @Nonnull static DAType wildcardWithSuperBound(@Nonnull DAType superbound); @Nonnull static DAType wildcardWithExtendsBound(@Nonnull DAType extendsBound);  }
@Test(expectedExceptions = NullPointerException.class) public void declared_null_qualifiedname_raises_NPE() throws Exception { DATypeFactory.declared(null); }
@Test(expectedExceptions = NullPointerException.class) public void declared_with_types_null_qualifiedname_raises_NPE() throws Exception { DATypeFactory.declared(null, Collections.<DAType>emptyList()); }
@Test(expectedExceptions = NullPointerException.class) public void declaredWithTypes_null_daType_list_raises_NPE() throws Exception { DATypeFactory.declared("sdsd", null); }
@Test public void declared_noPoint_in_qualifiedName() throws Exception { DAType daType = DATypeFactory.declared("Toto"); assertThat(daType.getKind()).isEqualTo(DATypeKind.DECLARED); assertThat(daType.getSimpleName().getName()).isEqualTo("Toto"); assertThat(daType.getQualifiedName().getName()).isEqualTo("Toto"); assertThat(daType.getTypeArgs()).isEmpty(); }
@Test public void declared() throws Exception { DAType daType = DATypeFactory.declared("com.acme.Toto"); assertThat(daType.getKind()).isEqualTo(DATypeKind.DECLARED); assertThat(daType.getSimpleName().getName()).isEqualTo("Toto"); assertThat(daType.getQualifiedName().getName()).isEqualTo("com.acme.Toto"); assertThat(daType.getTypeArgs()).isEmpty(); }
@Test public void declaredWithTypes() throws Exception { ImmutableList<DAType> typeArgs = ImmutableList.of(DATypeFactory.declared("java.lang.String")); DAType daType = DATypeFactory.declared("com.acme.Toto", typeArgs); assertThat(daType.getKind()).isEqualTo(DATypeKind.DECLARED); assertThat(daType.getSimpleName().getName()).isEqualTo("Toto"); assertThat(daType.getQualifiedName().getName()).isEqualTo("com.acme.Toto"); assertThat(daType.getTypeArgs()).isEqualTo(typeArgs); }