use of io.sundr.model.TypeDef in project sundrio by sundrio.
the class SimpleClassWithInheritanceTest method testEditable.
@Test
public void testEditable() {
TypeDef editable = ClazzAs.EDITABLE.apply(simpleClassWithDateDef);
System.out.println(editable);
assertEquals(Kind.CLASS, editable.getKind());
assertEquals("EditableSimpleClassWithDate", editable.getName());
assertEquals(1, editable.getExtendsList().size());
ClassRef superClass = editable.getExtendsList().iterator().next();
assertEquals(simpleClassWithDateDef.toInternalReference(), superClass);
}
use of io.sundr.model.TypeDef in project sundrio by sundrio.
the class SimpleClassWithInheritanceTest method testInline.
@Test
public void testInline() {
TypeDef inlineable = BuildableProcessor.inlineableOf(builderContext, simpleClassWithDateDef, inline);
System.out.println(inlineable);
assertEquals(Kind.CLASS, inlineable.getKind());
assertEquals("CallableSimpleClassWithDate", inlineable.getName());
}
use of io.sundr.model.TypeDef in project sundrio by sundrio.
the class SimpleClassWithParameterTest method testEditable.
@Test
public void testEditable() {
TypeDef editable = ClazzAs.EDITABLE.apply(simpleClassWithParameterDef);
System.out.println(editable);
assertEquals(Kind.CLASS, editable.getKind());
assertEquals("EditableSimpleClassWithParameter", editable.getName());
assertEquals(1, editable.getExtendsList().size());
ClassRef superClass = editable.getExtendsList().iterator().next();
assertEquals(simpleClassWithParameterDef.toInternalReference(), superClass);
}
use of io.sundr.model.TypeDef in project sundrio by sundrio.
the class SimpleClassWithParameterTest method testFluentImpl.
@Test
public void testFluentImpl() {
TypeDef fluentImpl = ClazzAs.FLUENT_IMPL.apply(simpleClassWithParameterDef);
System.out.println(fluentImpl);
assertEquals(Kind.CLASS, fluentImpl.getKind());
assertEquals("SimpleClassWithParameterFluentImpl", fluentImpl.getName());
assertEquals(1, fluentImpl.getExtendsList().size());
ClassRef superClass = fluentImpl.getExtendsList().iterator().next();
assertEquals("BaseFluent", superClass.getName());
assertEquals(1, superClass.getArguments().size());
assertEquals("A", superClass.getArguments().iterator().next().toString());
}
use of io.sundr.model.TypeDef in project sundrio by sundrio.
the class BuilderGeneratorTest method testFluentTemplate.
@Test
public void testFluentTemplate() throws IOException {
TypeDef type = new TypeDefBuilder().withName("Circle").withPackageName("my.Test").addNewConstructor().addNewArgument().withName("w").withTypeRef(Types.INT_REF).endArgument().addNewArgument().withName("w").withTypeRef(Types.INT_REF).endArgument().endConstructor().build();
File tmp = new File(System.getProperty("java.io.tmpdir"));
generate(type, tmp, "CircleFluent.java", Constants.DEFAULT_SOURCEFILE_TEMPLATE_LOCATION);
generate(type, tmp, "CircleBuilder.java", Constants.DEFAULT_SOURCEFILE_TEMPLATE_LOCATION);
}
Aggregations