Search in sources :

Example 1 with EnumConstant

use of com.spectralogic.ds3autogen.net.model.type.EnumConstant in project ds3_autogen by SpectraLogic.

the class NoneEnumGenerator_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(4));
    assertThat(result.get(0).getName(), is("one"));
    assertThat(result.get(1).getName(), is("two"));
    assertThat(result.get(2).getName(), is("three"));
    assertThat(result.get(3).getName(), is("NONE"));
}
Also used : Ds3EnumConstant(com.spectralogic.ds3autogen.api.models.apispec.Ds3EnumConstant) EnumConstant(com.spectralogic.ds3autogen.net.model.type.EnumConstant) Ds3EnumConstant(com.spectralogic.ds3autogen.api.models.apispec.Ds3EnumConstant) Test(org.junit.Test)

Example 2 with EnumConstant

use of com.spectralogic.ds3autogen.net.model.type.EnumConstant in project ds3_autogen by SpectraLogic.

the class NetHelper_Test method getEnumValues_FullList_Test.

@Test
public void getEnumValues_FullList_Test() {
    final String expected = "one,\ntwo,\nthree";
    final ImmutableList<EnumConstant> enumConstants = ImmutableList.of(new EnumConstant("one"), new EnumConstant("two"), new EnumConstant("three"));
    final String result = getEnumValues(enumConstants, 0);
    assertThat(result, is(expected));
}
Also used : EnumConstant(com.spectralogic.ds3autogen.net.model.type.EnumConstant) Test(org.junit.Test)

Example 3 with EnumConstant

use of com.spectralogic.ds3autogen.net.model.type.EnumConstant 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();
}
Also used : ImmutableList(com.google.common.collect.ImmutableList) EnumConstant(com.spectralogic.ds3autogen.net.model.type.EnumConstant) Ds3EnumConstant(com.spectralogic.ds3autogen.api.models.apispec.Ds3EnumConstant)

Example 4 with EnumConstant

use of com.spectralogic.ds3autogen.net.model.type.EnumConstant 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"));
}
Also used : Ds3EnumConstant(com.spectralogic.ds3autogen.api.models.apispec.Ds3EnumConstant) EnumConstant(com.spectralogic.ds3autogen.net.model.type.EnumConstant) Ds3EnumConstant(com.spectralogic.ds3autogen.api.models.apispec.Ds3EnumConstant) Test(org.junit.Test)

Example 5 with EnumConstant

use of com.spectralogic.ds3autogen.net.model.type.EnumConstant 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"));
}
Also used : Ds3EnumConstant(com.spectralogic.ds3autogen.api.models.apispec.Ds3EnumConstant) EnumConstant(com.spectralogic.ds3autogen.net.model.type.EnumConstant) Ds3EnumConstant(com.spectralogic.ds3autogen.api.models.apispec.Ds3EnumConstant) Test(org.junit.Test)

Aggregations

EnumConstant (com.spectralogic.ds3autogen.net.model.type.EnumConstant)5 Ds3EnumConstant (com.spectralogic.ds3autogen.api.models.apispec.Ds3EnumConstant)4 Test (org.junit.Test)4 ImmutableList (com.google.common.collect.ImmutableList)1