WorkspaceSnapshot { public List<UpdatableRecord<? extends UpdatableRecord<? extends UpdatableRecord<?>>>> getInserts() { return inserts; } WorkspaceSnapshot();  WorkspaceSnapshot(Product definingProduct, DSLContext create); static void load(DSLContext create,
                            List<URL> resources); static void load(DSLContext create, URL resource); @SuppressWarnings("unchecked") static List<UpdatableRecord<? extends UpdatableRecord<? extends UpdatableRecord<?>>>> selectForDelete(DSLContext create,
                                                                                                                 Product definingProduct); @SuppressWarnings("unchecked") static List<UpdatableRecord<? extends UpdatableRecord<? extends UpdatableRecord<?>>>> selectWorkspaceClosure(DSLContext create,
                                                                                                                        Product definingProduct); WorkspaceSnapshot deltaFrom(DSLContext create,
                                       WorkspaceSnapshot otherVersion); Product getDefiningProduct(); List<UpdatableRecord<? extends UpdatableRecord<? extends UpdatableRecord<?>>>> getInserts(); List<UpdatableRecord<? extends UpdatableRecord<? extends UpdatableRecord<?>>>> getUpdates(); @JsonIgnore int getVersion(); void load(DSLContext create); void serializeTo(OutputStream os);  }
@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))); }