use of com.spectralogic.ds3autogen.api.models.apispec.Ds3EnumConstant in project ds3_autogen by SpectraLogic.
the class EnumHelper_Test method testConvertDs3EnumConstants.
@Test
public void testConvertDs3EnumConstants() {
final Ds3EnumConstant alpha = new Ds3EnumConstant("Alpha", null);
final Ds3EnumConstant bravo = new Ds3EnumConstant("Bravo", null);
final ImmutableList<Ds3EnumConstant> enumConstants = ImmutableList.of(alpha, bravo);
final Ds3Type testDs3Type = new Ds3Type("Type", null, null, enumConstants);
final ImmutableList<String> stringsList = EnumHelper.convertDs3EnumConstants(testDs3Type);
assertFalse(stringsList.isEmpty());
assertEquals(2, stringsList.size());
assertEquals("DS3_TYPE_ALPHA", stringsList.get(0));
assertEquals("DS3_TYPE_BRAVO", stringsList.get(1));
}
use of com.spectralogic.ds3autogen.api.models.apispec.Ds3EnumConstant in project ds3_autogen by SpectraLogic.
the class NoneEnumGenerator method toEnumConstantsList.
/**
* Converts a list of Ds3EnumConstants into a list of Enum Constants and
* adds the enum constant NONE
*/
@Override
public ImmutableList<EnumConstant> toEnumConstantsList(final ImmutableList<Ds3EnumConstant> ds3EnumConstants) {
final ImmutableList.Builder<EnumConstant> builder = ImmutableList.builder();
builder.addAll(getEnumConstantsList(ds3EnumConstants));
builder.add(new EnumConstant("NONE"));
return builder.build();
}
use of com.spectralogic.ds3autogen.api.models.apispec.Ds3EnumConstant in project ds3_autogen by SpectraLogic.
the class BaseTypeGenerator_Test method getAllImports_EnumType_Test.
@Test
public void getAllImports_EnumType_Test() {
final ImmutableList<Ds3Element> ds3Elements = ImmutableList.of(new Ds3Element("ElementName1", "com.spectralogic.test.ElementType1", "ElementComponentType1", false), new Ds3Element("ElementName2", "ElementType2", "com.spectralogic.test.ElementComponentType2", false), new Ds3Element("ElementName3", "ElementType3", null, false));
final ImmutableList<Ds3EnumConstant> ds3EnumConstants = ImmutableList.of(new Ds3EnumConstant("EnumConstName1", null), new Ds3EnumConstant("EnumConstName2", null));
final Ds3Type enumType = new Ds3Type("TypeName", null, ds3Elements, ds3EnumConstants);
final ImmutableList<String> result = generator.getAllImports(enumType);
assertThat(result.size(), is(0));
}
use of com.spectralogic.ds3autogen.api.models.apispec.Ds3EnumConstant in project ds3_autogen by SpectraLogic.
the class BaseTypeGenerator_Test method getEnumConstants_FullList_Test.
@Test
public void getEnumConstants_FullList_Test() {
final ImmutableList<Ds3EnumConstant> enumConstants = ImmutableList.of(new Ds3EnumConstant("one", null), new Ds3EnumConstant("two", null), new Ds3EnumConstant("three", null));
final ImmutableList<EnumConstant> result = getEnumConstantsList(enumConstants);
assertThat(result.size(), is(3));
assertThat(result.get(0).getName(), is("one"));
assertThat(result.get(1).getName(), is("two"));
assertThat(result.get(2).getName(), is("three"));
}
use of com.spectralogic.ds3autogen.api.models.apispec.Ds3EnumConstant in project ds3_autogen by SpectraLogic.
the class BaseTypeGenerator_Test method toEnumConstants_FullList_Test.
@Test
public void toEnumConstants_FullList_Test() {
final ImmutableList<Ds3EnumConstant> enumConstants = ImmutableList.of(new Ds3EnumConstant("one", null), new Ds3EnumConstant("two", null), new Ds3EnumConstant("three", null));
final ImmutableList<EnumConstant> result = generator.toEnumConstantsList(enumConstants);
assertThat(result.size(), is(3));
assertThat(result.get(0).getName(), is("one"));
assertThat(result.get(1).getName(), is("two"));
assertThat(result.get(2).getName(), is("three"));
}
Aggregations