use of io.crnk.gen.typescript.model.TSClassType in project crnk-framework by crnk-project.
the class TypescriptUtilsTest method getNestedInterfacesThrowsExceptionOnCreateIfNoParent.
@Test(expected = IllegalStateException.class)
public void getNestedInterfacesThrowsExceptionOnCreateIfNoParent() {
TSClassType classType = new TSClassType();
classType.setName("TestClass");
TypescriptUtils.getNestedInterface(classType, "TestInterface", true);
}
use of io.crnk.gen.typescript.model.TSClassType in project crnk-framework by crnk-project.
the class TypescriptUtilsTest method getNestedInterfaesCreatesNewInterface.
@Test
public void getNestedInterfaesCreatesNewInterface() {
TSModule module = new TSModule();
module.setName("TestModule");
TSClassType classType = new TSClassType();
classType.setParent(module);
classType.setName("TestClass");
module.getElements().add(classType);
TSInterfaceType testInterface = TypescriptUtils.getNestedInterface(classType, "TestInterface", true);
Assert.assertEquals("TestInterface", testInterface.getName());
Assert.assertTrue(testInterface.getParent() instanceof TSModule);
Assert.assertEquals(module, testInterface.getParent().getParent());
Assert.assertEquals("TestClass", ((TSModule) testInterface.getParent()).getName());
Assert.assertEquals(2, module.getElements().size());
}
use of io.crnk.gen.typescript.model.TSClassType in project crnk-framework by crnk-project.
the class TypescriptUtilsTest method getNestedInterfacesReturnsNullIfDoesNotExistsAndNonCreateRequested.
@Test
public void getNestedInterfacesReturnsNullIfDoesNotExistsAndNonCreateRequested() {
TSModule module = new TSModule();
module.setName("TestModule");
TSClassType classType = new TSClassType();
classType.setParent(module);
classType.setName("TestClass");
module.getElements().add(classType);
TSInterfaceType testInterface = TypescriptUtils.getNestedInterface(classType, "TestInterface", false);
Assert.assertNull(testInterface);
}
use of io.crnk.gen.typescript.model.TSClassType in project crnk-framework by crnk-project.
the class TypescriptUtilsTest method getNestedInterfacesReturnsNullIfNoParent.
@Test
public void getNestedInterfacesReturnsNullIfNoParent() {
TSClassType classType = new TSClassType();
classType.setName("TestClass");
TSInterfaceType testInterface = TypescriptUtils.getNestedInterface(classType, "TestInterface", false);
Assert.assertNull(testInterface);
}
Aggregations