use of cz.habarta.typescript.generator.parser.JaxrsApplicationParser in project typescript-generator by vojtechhabarta.
the class JaxrsApplicationTest method testExcludedType.
@Test
public void testExcludedType() {
final Settings settings = TestUtils.settings();
settings.setExcludeFilter(Arrays.asList(A.class.getName(), J.class.getName()), null);
final JaxrsApplicationParser jaxrsApplicationParser = createJaxrsApplicationParser(settings);
final JaxrsApplicationParser.Result result = jaxrsApplicationParser.tryParse(new SourceType<>(TestResource1.class));
Assertions.assertNotNull(result);
Assertions.assertTrue(!getTypes(result.discoveredTypes).contains(A.class));
Assertions.assertTrue(getTypes(result.discoveredTypes).contains(JGenericArrayType.of(J[].class)));
}
use of cz.habarta.typescript.generator.parser.JaxrsApplicationParser in project typescript-generator by vojtechhabarta.
the class JaxrsApplicationTest method testReturnedTypesFromResource.
@Test
public void testReturnedTypesFromResource() {
JaxrsApplicationParser jaxrsApplicationParser = createJaxrsApplicationParser(TestUtils.settings());
final JaxrsApplicationParser.Result result = jaxrsApplicationParser.tryParse(new SourceType<>(TestResource1.class));
Assertions.assertNotNull(result);
List<Type> types = getTypes(result.discoveredTypes);
final List<Type> expectedTypes = Arrays.asList(A.class, new TypeReference<List<B>>() {
}.getType(), C.class, new TypeReference<List<D>>() {
}.getType(), List.class, E.class, new TypeReference<List<F>>() {
}.getType(), G.class, new TypeReference<Map<String, H>>() {
}.getType(), I.class, JGenericArrayType.of(J[].class), // types handled by DefaultTypeProcessor
String.class, Boolean.class, Character.class, Number.class, Integer.class, int.class, void.class);
assertHasSameItems(expectedTypes, types);
}
use of cz.habarta.typescript.generator.parser.JaxrsApplicationParser in project typescript-generator by vojtechhabarta.
the class JaxrsApplicationTest method createJaxrsApplicationParser.
private static JaxrsApplicationParser createJaxrsApplicationParser(Settings settings) {
final TypeProcessor typeProcessor = new TypeScriptGenerator(settings).getCommonTypeProcessor();
final JaxrsApplicationParser jaxrsApplicationParser = new JaxrsApplicationParser(settings, typeProcessor);
return jaxrsApplicationParser;
}
Aggregations