use of javax.lang.model.type.TypeMirror in project storio by pushtorefresh.
the class JavaTypeTest method fromIllegalArgumentException.
@Test
public void fromIllegalArgumentException() {
// given
expectedException.expect(IllegalArgumentException.class);
expectedException.expectMessage("Unsupported type: null");
final TypeMirror typeMirror = mock(TypeMirror.class);
when(typeMirror.getKind()).thenReturn(null);
when(typeMirror.toString()).thenReturn(null);
// when
JavaType.from(typeMirror);
// then
fail("IllegalArgumentException expected.");
}
use of javax.lang.model.type.TypeMirror in project storio by pushtorefresh.
the class JavaTypeTest method mockTypeMirror.
@NotNull
private static TypeMirror mockTypeMirror(@Nullable TypeKind typeKind, @Nullable String typeName) {
final TypeMirror typeMirror = mock(TypeMirror.class);
when(typeMirror.getKind()).thenReturn(typeKind);
when(typeMirror.toString()).thenReturn(typeName);
return typeMirror;
}
use of javax.lang.model.type.TypeMirror in project storio by pushtorefresh.
the class JavaTypeTest method fromString.
@Test
public void fromString() {
final TypeMirror typeMirror = mockTypeMirror(null, String.class.getCanonicalName());
assertThat(JavaType.from(typeMirror)).isEqualTo(STRING);
}
use of javax.lang.model.type.TypeMirror in project storio by pushtorefresh.
the class JavaTypeTest method fromFloat.
@Test
public void fromFloat() {
final TypeMirror typeMirror = mockTypeMirror(TypeKind.FLOAT, null);
assertThat(JavaType.from(typeMirror)).isEqualTo(FLOAT);
}
use of javax.lang.model.type.TypeMirror in project storio by pushtorefresh.
the class JavaTypeTest method fromShort.
@Test
public void fromShort() {
final TypeMirror typeMirror = mockTypeMirror(TypeKind.SHORT, null);
assertThat(JavaType.from(typeMirror)).isEqualTo(SHORT);
}
Aggregations