use of com.spectralogic.ds3autogen.go.models.request.WithConstructor in project ds3_autogen by SpectraLogic.
the class RequestGeneratorUtil_Test method toWithConstructor_Test.
@Test
public void toWithConstructor_Test() {
final ImmutableList<WithConstructor> expected = ImmutableList.of(new WithConstructor("ParamOne", "Type1", "param_one", "paramOne.String()"), new WithConstructor("ParamTwo", "int", "param_two", "strconv.Itoa(paramTwo)"), new WithConstructor("TypeName", "TypeName", "type", "typeName.String()"));
final ImmutableList<Ds3Param> params = ImmutableList.of(new Ds3Param("ParamOne", "Type1", false), new Ds3Param("ParamTwo", "int", false), new Ds3Param("Type", "com.test.TypeName", false));
assertThat(params.size(), is(expected.size()));
params.forEach(param -> assertThat(expected, hasItem(toWithConstructor(param))));
}
use of com.spectralogic.ds3autogen.go.models.request.WithConstructor 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.go.models.request.WithConstructor 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)));
}
Aggregations