### Question:
ProjectConverter extends StringValueConverter<Project> { @Override public Project convertToModel(String id, Map<String, Object> jsonMap) throws IOException { Project p = new Project(); p.setCode(id); updateValue(p, jsonMap); return p; }  @Override String getId(Project jpaEntity); @Override String getEntityIdFieldName(); @Override String getValue(Project jpaEntity); @Override void setValue(Project jpaEntity, String value); @Override Project convertToModel(String id, Map<String, Object> jsonMap);  }### Answer:
@Test public void convertToModel() throws IOException { ProjectConverter converter = new ProjectConverter(); { Map<String, Object> data = new HashMap<String, Object>(); data.put(ProjectService.FIELD_CODE, "as7"); data.put("name", "AS 7"); Project p = converter.convertToModel("as7", data); assertEquals("as7", p.getCode()); TestUtils.assertJsonContent("{\"name\":\"AS 7\",\"" + ProjectService.FIELD_CODE + "\":\"as7\"}", p.getValue()); } { Map<String, Object> data = new HashMap<String, Object>(); Project p = converter.convertToModel("as7", data); assertEquals("as7", p.getCode()); assertEquals("{}", p.getValue()); } { Project p = converter.convertToModel("as7", null); assertEquals("as7", p.getCode()); assertEquals("", p.getValue()); } }