Search in sources :

Example 1 with StringArrayMap

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

the class TestMap method testStringArrayMap.

@Test
public void testStringArrayMap() {
    TestDataTemplateUtil.FieldInfo fieldInfo = TestDataTemplateUtil.fieldInfo(new MapTest(), "stringArrayMap");
    @SuppressWarnings("unchecked") Class<StringArrayMap> templateClass = (Class<StringArrayMap>) fieldInfo.getFieldClass();
    MapDataSchema schema = (MapDataSchema) fieldInfo.getField().getType();
    Map<String, StringArray> input = new HashMap<String, StringArray>();
    for (int i = 0; i < 5; ++i) {
        String key = "input" + i;
        input.put(key, new StringArray());
        input.get(key).add("subinput" + i);
    }
    Map<String, StringArray> adds = new HashMap<String, StringArray>();
    for (int i = 0; i < 5; ++i) {
        String key = "add" + i;
        adds.put(key, new StringArray());
        adds.get(key).add("subadd" + i);
    }
    TestMapTemplate.testMap(templateClass, schema, input, adds);
}
Also used : TestDataTemplateUtil(com.linkedin.data.template.TestDataTemplateUtil) StringArrayMap(com.linkedin.data.template.StringArrayMap) HashMap(java.util.HashMap) MapDataSchema(com.linkedin.data.schema.MapDataSchema) StringArray(com.linkedin.data.template.StringArray) Test(org.testng.annotations.Test)

Aggregations

MapDataSchema (com.linkedin.data.schema.MapDataSchema)1 StringArray (com.linkedin.data.template.StringArray)1 StringArrayMap (com.linkedin.data.template.StringArrayMap)1 TestDataTemplateUtil (com.linkedin.data.template.TestDataTemplateUtil)1 HashMap (java.util.HashMap)1 Test (org.testng.annotations.Test)1