@Test
public void testSerializeSnapshot() throws Exception {

    Agency pseudoScientist = RECORDS.newAgency("Behold the Pseudo Scientist!");
    pseudoScientist.insert();
    Product definingProduct = RECORDS.newProduct("zee product");
    definingProduct.insert();
    StateSnapshot retrieved = new StateSnapshot(RECORDS.create(),
                                                Collections.emptyList());
    assertEquals(2, retrieved.getInserts()
                             .size());
    ObjectMapper mapper = new ObjectMapper();
    mapper.registerModule(new CoREModule());
    File temp = File.createTempFile("snaptest", "wsp");
    temp.deleteOnExit();
    try (FileOutputStream os = new FileOutputStream(temp)) {
        mapper.writeValue(os, retrieved);
    }
    StateSnapshot deserialized;
    try (FileInputStream is = new FileInputStream(temp)) {
        deserialized = mapper.readValue(is, StateSnapshot.class);
    }
    assertEquals(2, deserialized.getInserts()
                                .size());
    assertTrue(deserialized.getInserts()
                           .stream()
                           .anyMatch(r -> pseudoScientist.equals(r)));
}