@Test public void writeFields() throws Exception { // writer.writeObjectType(SPEC_NAME); writer.writeOid(RootOidDefault.deString(SPEC_NAME + ":" + "D01", new OidMarshaller())); writer.writeField("number", 1023); writer.writeField("string", "testing"); writer.flush(); final DBCollection instances = testDb.getCollection(SPEC_NAME); assertEquals(1, instances.getCount()); final DBObject object = instances.findOne(); assertEquals(SPEC_NAME + ":" + "D01", object.get("_oid")); assertEquals("1023", object.get("number")); assertEquals("testing", object.get("string")); }
@Test public void serialNumberNotStored() throws Exception { // writer.writeId("D01"); writer.writeOid(RootOidDefault.deString(SPEC_NAME + ":" + "D01", new OidMarshaller())); writer.flush(); final DBCollection instances = testDb.getCollection(SPEC_NAME); assertEquals(1, instances.getCount()); final DBObject object = instances.findOne(); assertEquals(SPEC_NAME + ":" + "D01", object.get("_oid")); assertEquals("D01", object.get("_id")); assertEquals(2, object.keySet().size()); }