use of com.spectralogic.ds3autogen.java.models.Element in project ds3_autogen by SpectraLogic.
the class JavaHelper_Test method sortModelConstructorArgs_FullList_Test.
@Test
public void sortModelConstructorArgs_FullList_Test() {
final ImmutableList<Element> expectedResult = ImmutableList.of(new Element("Elmt1", "Type1", null), new Element("Elmt2", "Type2", null), new Element("Elmt3", "array", "Type3"));
final ImmutableList<Element> elements = ImmutableList.of(new Element("Elmt2", "Type2", null), new Element("Elmt3", "array", "Type3"), new Element("Elmt1", "Type1", null));
final ImmutableList<Element> result = sortModelConstructorArgs(elements);
for (int i = 0; i < elements.size(); i++) {
assertTrue(result.get(i).getName().equals(expectedResult.get(i).getName()));
}
final ImmutableList<Element> emptyResult = sortModelConstructorArgs(null);
assertTrue(emptyResult.isEmpty());
}
use of com.spectralogic.ds3autogen.java.models.Element in project ds3_autogen by SpectraLogic.
the class JavaHelper_Test method getModelVariable_ArrayComponentType_Test.
@Test
public void getModelVariable_ArrayComponentType_Test() {
final String expectedResult = " @JsonProperty(\"XmlName\")\n" + " @JacksonXmlElementWrapper(useWrapping = false)\n" + " private List<BlobApiBean> testName = new ArrayList<>();";
final Element element = new Element("testName", "xmlName", false, false, "array", "com.spectralogic.s3.common.platform.domain.BlobApiBean");
final String result = getModelVariable(element);
assertThat(result, is(expectedResult));
}
use of com.spectralogic.ds3autogen.java.models.Element in project ds3_autogen by SpectraLogic.
the class JavaHelper_Test method getModelVariable_ComponentType_Wrapper_Test.
@Test
public void getModelVariable_ComponentType_Wrapper_Test() {
final String expectedResult = " @JsonProperty(\"TestName\")\n" + " @JacksonXmlElementWrapper(useWrapping = true)\n" + " private List<BlobApiBean> testName = new ArrayList<>();";
final Element element = new Element("testName", "xmlName", false, true, "array", "com.spectralogic.s3.common.platform.domain.BlobApiBean");
final String result = getModelVariable(element);
assertThat(result, is(expectedResult));
}
use of com.spectralogic.ds3autogen.java.models.Element in project ds3_autogen by SpectraLogic.
the class JavaHelper_Test method getModelConstructorArgs_FullList_Test.
@Test
public void getModelConstructorArgs_FullList_Test() {
final String expectedResult = "final Type1 elmt1, final Type2 elmt2, final List<Type3> elmt3";
final ImmutableList<Element> elements = ImmutableList.of(new Element("Elmt2", "Type2", null), new Element("Elmt1", "Type1", null), new Element("Elmt3", "array", "Type3"));
final String result = getModelConstructorArgs(elements);
assertThat(result, is(expectedResult));
final String emptyResult = getModelConstructorArgs(null);
assertThat(emptyResult, is(""));
}
Aggregations