use of cz.habarta.typescript.generator.parser.BeanModel in project typescript-generator by vojtechhabarta.
the class Jackson2ParserTest method testRegisteredSubtypeName.
@Test
public void testRegisteredSubtypeName() {
final Jackson2Parser jacksonParser = getJackson2Parser();
final Model model = jacksonParser.parseModel(SubTypeDiscriminatedByName5.class);
final BeanModel bean5 = model.getBean(SubTypeDiscriminatedByName5.class);
Assertions.assertEquals("NamedByModule", bean5.getDiscriminantLiteral());
}
use of cz.habarta.typescript.generator.parser.BeanModel in project typescript-generator by vojtechhabarta.
the class Jackson2ParserTest method testChangedNameProperty.
@Test
public void testChangedNameProperty() {
final Jackson2Parser jacksonParser = getJackson2Parser();
final Model model = jacksonParser.parseModel(DummyBeanJackson2.class);
Assertions.assertTrue(model.getBeans().size() > 0);
final BeanModel beanModel = model.getBeans().get(0);
Assertions.assertEquals("DummyBeanJackson2", beanModel.getOrigin().getSimpleName());
Assertions.assertTrue(beanModel.getProperties().size() > 0);
Assertions.assertEquals("changedNameProperty", beanModel.getProperties().get(0).getName());
}
use of cz.habarta.typescript.generator.parser.BeanModel in project typescript-generator by vojtechhabarta.
the class Jackson2ParserTest method testConflictingJsonTypeInfoProperty.
@Test
public void testConflictingJsonTypeInfoProperty() {
final Jackson2Parser jacksonParser = getJackson2Parser();
final Model model = jacksonParser.parseModel(InheritedClass.class);
Assertions.assertTrue(model.getBeans().size() > 0);
final BeanModel beanModel = model.getBeans().get(0);
Assertions.assertEquals(1, beanModel.getProperties().size());
}
use of cz.habarta.typescript.generator.parser.BeanModel in project typescript-generator by vojtechhabarta.
the class OptionalAnnotationTest method testModel.
private void testModel(Model model, boolean optional) {
Assertions.assertEquals(1, model.getBeans().size());
BeanModel beanModel = model.getBeans().get(0);
Assertions.assertEquals(2, beanModel.getProperties().size());
for (PropertyModel propertyModel : beanModel.getProperties()) {
Assertions.assertEquals(optional, propertyModel.isOptional());
}
}
use of cz.habarta.typescript.generator.parser.BeanModel in project typescript-generator by vojtechhabarta.
the class JaxrsApplicationTest method testWithParsing.
private void testWithParsing(List<SourceType<Type>> types, boolean exactMatch) {
final Model model = new TypeScriptGenerator(TestUtils.settings()).getModelParser().parseModel(types);
final ArrayList<Class<?>> classes = new ArrayList<>();
for (BeanModel beanModel : model.getBeans()) {
classes.add(beanModel.getOrigin());
}
final List<Class<?>> expectedClasses = Arrays.asList(A.class, B.class, C.class, D.class, E.class, F.class, G.class, H.class, I.class, J.class);
if (exactMatch) {
assertHasSameItems(expectedClasses, classes);
} else {
Assertions.assertTrue(classes.containsAll(expectedClasses));
}
}
Aggregations