Search in sources :

Example 1 with MapModel

use of org.apache.servicecomb.demo.server.MapModel in project java-chassis by ServiceComb.

the class CodeFirstPojoClient method remoteCodeFirstPojo_testMapModel.

private void remoteCodeFirstPojo_testMapModel(CodeFirstPojoIntf codeFirst) {
    MapModel model = new MapModel();
    model.setName("hello");
    Map<String, String> userMap = new HashMap<>();
    userMap.put("u1", "u1");
    userMap.put("u2", null);
    model.setNames(userMap);
    MapModel result = codeFirst.testMapModel(model);
    TestMgr.check(result.getName(), "hello");
    TestMgr.check(result.getNames().get("u1"), "u1");
    TestMgr.check(result.getNames().get("u2"), null);
    model = new MapModel();
    model.setName(null);
    userMap = new HashMap<>();
    userMap.put("u1", "u1");
    userMap.put("u2", null);
    model.setNames(userMap);
    result = codeFirst.testMapModel(model);
    TestMgr.check(result.getName(), null);
    TestMgr.check(result.getNames().get("u1"), "u1");
    TestMgr.check(result.getNames().get("u2"), null);
    model = new MapModel();
    model.setName(null);
    userMap = new HashMap<>();
    userMap.put("u1", "u1");
    userMap.put("u2", "");
    model.setNames(userMap);
    result = codeFirst.testMapModel(model);
    TestMgr.check(result.getName(), null);
    TestMgr.check(result.getNames().get("u1"), "u1");
    TestMgr.check(result.getNames().get("u2"), "");
}
Also used : HashMap(java.util.HashMap) MapModel(org.apache.servicecomb.demo.server.MapModel)

Aggregations

HashMap (java.util.HashMap)1 MapModel (org.apache.servicecomb.demo.server.MapModel)1