Search in sources :

Example 1 with StringMapMap

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

the class TestMap method testStringMapMap.

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

Aggregations

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