use of com.spectralogic.ds3autogen.java.models.EnumConstant in project ds3_autogen by SpectraLogic.
the class BaseTypeGenerator_Test method toEnumConstantList_FullList_Test.
@Test
public void toEnumConstantList_FullList_Test() {
final ImmutableList<Ds3EnumConstant> ds3EnumConstants = ImmutableList.of(new Ds3EnumConstant("Name1", null), new Ds3EnumConstant("Name2", null));
final ImmutableList<EnumConstant> result = generator.toEnumConstantList(ds3EnumConstants);
assertThat(result.size(), is(2));
assertThat(result.get(0).getName(), is("Name1"));
assertThat(result.get(1).getName(), is("Name2"));
}
use of com.spectralogic.ds3autogen.java.models.EnumConstant in project ds3_autogen by SpectraLogic.
the class BaseTypeGenerator_Test method toEnumConstant_Test.
@Test
public void toEnumConstant_Test() {
final Ds3EnumConstant ds3EnumConstant = new Ds3EnumConstant("Name", null);
final EnumConstant result = toEnumConstant(ds3EnumConstant);
assertThat(result.getName(), is("Name"));
}
use of com.spectralogic.ds3autogen.java.models.EnumConstant in project ds3_autogen by SpectraLogic.
the class ChecksumTypeGenerator_Test method toEnumConstantList_FullList_Test.
@Test
public void toEnumConstantList_FullList_Test() {
final ImmutableList<Ds3EnumConstant> enumConstants = ImmutableList.of(new Ds3EnumConstant("CRC_32", null), new Ds3EnumConstant("CRC_32C", null), new Ds3EnumConstant("MD5", null), new Ds3EnumConstant("SHA_256", null), new Ds3EnumConstant("SHA_512", null));
final ImmutableList<EnumConstant> result = generator.toEnumConstantList(enumConstants);
assertThat(result.size(), is(6));
assertThat(result.get(0).getName(), is("CRC_32"));
assertThat(result.get(1).getName(), is("CRC_32C"));
assertThat(result.get(2).getName(), is("MD5"));
assertThat(result.get(3).getName(), is("SHA_256"));
assertThat(result.get(4).getName(), is("SHA_512"));
assertThat(result.get(5).getName(), is("NONE"));
}
use of com.spectralogic.ds3autogen.java.models.EnumConstant in project ds3_autogen by SpectraLogic.
the class JavaHelper_Test method getEnumValues_FullList_Test.
@Test
public void getEnumValues_FullList_Test() {
final String expectedResult = " DELETE,\n" + " GET,\n" + " HEAD,\n" + " POST,\n" + " PUT";
final ImmutableList<EnumConstant> enumConstants = ImmutableList.of(new EnumConstant("DELETE"), new EnumConstant("GET"), new EnumConstant("HEAD"), new EnumConstant("POST"), new EnumConstant("PUT"));
final String result = getEnumValues(enumConstants, 1);
assertThat(result, is(expectedResult));
assertThat(getEnumValues(ImmutableList.of(), 1), is(""));
assertThat(getEnumValues(null, 1), is(""));
}
use of com.spectralogic.ds3autogen.java.models.EnumConstant in project ds3_autogen by SpectraLogic.
the class ChecksumTypeGenerator method toEnumConstantList.
/**
* Converts a list of Ds3EnumConstants into a list of EnumConstant models
* @param ds3EnumConstants A list of Ds3EnumConstants
* @return A list of EnumConstant models
*/
@Override
public ImmutableList<EnumConstant> toEnumConstantList(final ImmutableList<Ds3EnumConstant> ds3EnumConstants) {
if (isEmpty(ds3EnumConstants)) {
return ImmutableList.of();
}
final ImmutableList.Builder<EnumConstant> builder = ImmutableList.builder();
for (final Ds3EnumConstant ds3EnumConstant : ds3EnumConstants) {
builder.add(toEnumConstant(ds3EnumConstant));
}
builder.add(new EnumConstant("NONE"));
return builder.build();
}
Aggregations