Search in sources :

Example 1 with StringMapArray

use of com.linkedin.data.template.StringMapArray in project rest.li by linkedin.

the class TestArray method testStringMapArray.

@Test
public void testStringMapArray() {
    TestDataTemplateUtil.FieldInfo fieldInfo = TestDataTemplateUtil.fieldInfo(new ArrayTest(), "stringMapArray");
    @SuppressWarnings("unchecked") Class<StringMapArray> templateClass = (Class<StringMapArray>) fieldInfo.getFieldClass();
    ArrayDataSchema schema = (ArrayDataSchema) fieldInfo.getField().getType();
    List<StringMap> input = new ArrayList<StringMap>();
    for (int i = 0; i < 5; ++i) {
        input.add(new StringMap());
        input.get(i).put("input key " + i, "value " + i);
    }
    List<StringMap> adds = new ArrayList<StringMap>();
    for (int i = 0; i < 5; ++i) {
        adds.add(new StringMap());
        input.get(i).put("add key " + i, "value " + i);
    }
    TestArrayTemplate.testArray(templateClass, schema, input, adds);
}
Also used : ArrayDataSchema(com.linkedin.data.schema.ArrayDataSchema) TestDataTemplateUtil(com.linkedin.data.template.TestDataTemplateUtil) StringMap(com.linkedin.data.template.StringMap) StringMapArray(com.linkedin.data.template.StringMapArray) ArrayList(java.util.ArrayList) Test(org.testng.annotations.Test)

Aggregations

ArrayDataSchema (com.linkedin.data.schema.ArrayDataSchema)1 StringMap (com.linkedin.data.template.StringMap)1 StringMapArray (com.linkedin.data.template.StringMapArray)1 TestDataTemplateUtil (com.linkedin.data.template.TestDataTemplateUtil)1 ArrayList (java.util.ArrayList)1 Test (org.testng.annotations.Test)1