Search in sources :

Example 1 with EnumModel

use of cz.habarta.typescript.generator.parser.EnumModel in project typescript-generator by vojtechhabarta.

the class NumberEnumTest method testParser.

@Test
public void testParser() {
    final Settings settings = TestUtils.settings();
    final ModelParser parser = new TypeScriptGenerator(settings).getModelParser();
    final Model model = parser.parseModel(SomeCode.class);
    Assert.assertEquals(1, model.getEnums().size());
    final EnumModel enumModel = model.getEnums().get(0);
    Assert.assertEquals(EnumKind.NumberBased, enumModel.getKind());
    Assert.assertEquals(2, enumModel.getMembers().size());
    Assert.assertEquals(10, ((Number) enumModel.getMembers().get(0).getEnumValue()).intValue());
    Assert.assertEquals(11, ((Number) enumModel.getMembers().get(1).getEnumValue()).intValue());
}
Also used : EnumModel(cz.habarta.typescript.generator.parser.EnumModel) EnumModel(cz.habarta.typescript.generator.parser.EnumModel) Model(cz.habarta.typescript.generator.parser.Model) ModelParser(cz.habarta.typescript.generator.parser.ModelParser) Test(org.junit.Test)

Aggregations

EnumModel (cz.habarta.typescript.generator.parser.EnumModel)1 Model (cz.habarta.typescript.generator.parser.Model)1 ModelParser (cz.habarta.typescript.generator.parser.ModelParser)1 Test (org.junit.Test)1