use of com.spectralogic.ds3autogen.api.models.apispec.Ds3Param in project ds3_autogen by SpectraLogic.
the class RequestGeneratorUtil_Test method toWithConstructors_NonNullableParams_Test.
@Test
public void toWithConstructors_NonNullableParams_Test() {
final ImmutableList<WithConstructor> expected = ImmutableList.of(new WithConstructor("ParamOne", "Type1", "param_one", "paramOne.String()"), new WithConstructor("ParamThree", "int", "param_three", "strconv.Itoa(paramThree)"), new WithConstructor("TypeName", "TypeName", "type", "typeName.String()"));
final ImmutableList<Ds3Param> params = ImmutableList.of(new Ds3Param("ParamOne", "Type1", false), new Ds3Param("ParamTwo", "void", false), new Ds3Param("ParamThree", "int", false), new Ds3Param("ParamFour", "VOID", false), new Ds3Param("Type", "com.test.TypeName", false));
final ImmutableList<WithConstructor> result = toWithConstructors(params, false);
assertThat(result.size(), is(expected.size()));
expected.forEach(expectedConst -> assertThat(result, hasItem(expectedConst)));
}
use of com.spectralogic.ds3autogen.api.models.apispec.Ds3Param in project ds3_autogen by SpectraLogic.
the class RequestGeneratorUtil_Test method toGoArgument_Test.
@Test
public void toGoArgument_Test() {
final ImmutableList<Arguments> expectedArgs = ImmutableList.of(new Arguments("", "param1"), new Arguments("*int", "param2"), new Arguments("float64", "param3"), new Arguments("string", "param4"), new Arguments("TestType", "testType"));
final ImmutableList<Ds3Param> params = ImmutableList.of(new Ds3Param("Param1", "void", false), new Ds3Param("Param2", "java.lang.Integer", true), new Ds3Param("Param3", "double", false), new Ds3Param("Param4", "java.util.UUID", false), new Ds3Param("Type", "com.test.TestType", false));
for (int i = 0; i < params.size(); i++) {
final Arguments result = toGoArgument(params.get(i));
final Arguments expected = expectedArgs.get(i);
assertThat(result.getName(), is(expected.getName()));
assertThat(result.getType(), is(expected.getType()));
}
}
use of com.spectralogic.ds3autogen.api.models.apispec.Ds3Param in project ds3_autogen by SpectraLogic.
the class RequestGeneratorUtil_Test method toWithConstructors_NullableParams_Test.
@Test
public void toWithConstructors_NullableParams_Test() {
final ImmutableList<WithConstructor> expected = ImmutableList.of(new WithConstructor("ParamOne", "*Type1", "param_one", "paramOne.String()"), new WithConstructor("ParamThree", "*int", "param_three", "strconv.Itoa(*paramThree)"), new WithConstructor("TypeName", "*TypeName", "type", "typeName.String()"));
final ImmutableList<Ds3Param> params = ImmutableList.of(new Ds3Param("ParamOne", "Type1", true), new Ds3Param("ParamTwo", "void", true), new Ds3Param("ParamThree", "int", true), new Ds3Param("ParamFour", "VOID", true), new Ds3Param("Type", "com.test.TypeName", true));
final ImmutableList<WithConstructor> result = toWithConstructors(params, true);
assertThat(result.size(), is(expected.size()));
expected.forEach(expectedConst -> assertThat(result, hasItem(expectedConst)));
}
use of com.spectralogic.ds3autogen.api.models.apispec.Ds3Param in project ds3_autogen by SpectraLogic.
the class RequestGeneratorUtil_Test method toSimpleVariables_FullList_Test.
@Test
public void toSimpleVariables_FullList_Test() {
final ImmutableList<SimpleVariable> expected = ImmutableList.of(new SimpleVariable("paramOne"), new SimpleVariable("paramTwo"), new SimpleVariable("paramThree"), new SimpleVariable("typeName"));
final ImmutableList<Ds3Param> params = ImmutableList.of(new Ds3Param("ParamOne", "string", false), new Ds3Param("ParamTwo", "string", true), new Ds3Param("ParamThree", "string", false), new Ds3Param("Type", "com.test.TypeName", false));
final ImmutableList<SimpleVariable> result = toSimpleVariables(params);
assertThat(result.size(), is(expected.size()));
expected.forEach(expectedVar -> assertThat(result, hasItem(expectedVar)));
}
use of com.spectralogic.ds3autogen.api.models.apispec.Ds3Param in project ds3_autogen by SpectraLogic.
the class RequestGeneratorUtil_Test method toGoArgumentsList_FullList_Test.
@Test
public void toGoArgumentsList_FullList_Test() {
final ImmutableList<String> expectedTypes = ImmutableList.of("", "*int", "float64", "string");
final ImmutableList<Ds3Param> params = ImmutableList.of(new Ds3Param("Param1", "void", false), new Ds3Param("Param2", "java.lang.Integer", true), new Ds3Param("Param3", "double", false), new Ds3Param("Param4", "java.util.UUID", false));
final ImmutableList<Arguments> result = toGoArgumentsList(params);
assertThat(result.size(), is(4));
for (int i = 0; i < result.size(); i++) {
assertThat(result.get(i).getType(), is(expectedTypes.get(i)));
}
}
Aggregations