@Test public void toProperties_null() { Person object = new Person(); object.name = null; object.age = 23; final Map<String, Object> stringObjectMap = mapper.toProperties(object); ASSERT.that(stringObjectMap.get("type")).isEqualTo("person"); ASSERT.that(stringObjectMap.containsKey("name")).isTrue(); ASSERT.that(stringObjectMap.get("name")).isNull(); ASSERT.that(stringObjectMap.get("age")).isEqualTo(23); }
@Override public Map<String, Object> toProperties(Person object) { final Map<String, Object> properties = new HashMap<>(); properties.put("type", "person"); properties.put("name", object.name); properties.put("age", object.age); return properties; }
Person implements Mapper<Person> { @Override public Map<String, Object> toProperties(Person object) { final Map<String, Object> properties = new HashMap<>(); properties.put("type", "person"); properties.put("name", object.name); properties.put("age", object.age); return properties; } }
Person implements Mapper<Person> { @Override public Map<String, Object> toProperties(Person object) { final Map<String, Object> properties = new HashMap<>(); properties.put("type", "person"); properties.put("name", object.name); properties.put("age", object.age); return properties; }  }
Person implements Mapper<Person> { @Override public Map<String, Object> toProperties(Person object) { final Map<String, Object> properties = new HashMap<>(); properties.put("type", "person"); properties.put("name", object.name); properties.put("age", object.age); return properties; }  @Override Person toObject(Map<String, Object> properties); @Override Map<String, Object> toProperties(Person object); }
Person implements Mapper<Person> { @Override public Map<String, Object> toProperties(Person object) { final Map<String, Object> properties = new HashMap<>(); properties.put("type", "person"); properties.put("name", object.name); properties.put("age", object.age); return properties; }  @Override Person toObject(Map<String, Object> properties); @Override Map<String, Object> toProperties(Person object);  }