* Verify that an entity that supports dirty-tracking results in fewer properties in the payload
* and that the dirty-tracking methods are called as expected.
*/
@Test
public void testSparseProperties() throws IOException {
PersistentEmployee e = makePersistentEmployee();
e.setTrackedProperty("trackedProperty");
assertEquals(Collections.singleton("trackedProperty"), e.dirtyPropertyNames());
StringWriter out = new StringWriter();
flatpack.getPacker().pack(FlatPackEntity.entity(e), out);
assertFalse(out.toString().contains("name"));
assertTrue(out.toString().contains("trackedProperty"));
FlatPackEntity<PersistentEmployee> entity = flatpack.getUnpacker()
.unpack(PersistentEmployee.class, new StringReader(out.toString()), null);
PersistentEmployee e2 = entity.getValue();
assertTrue(e2.wasPersistent());
assertTrue(e2.dirtyPropertyNames().isEmpty());
}