@Test
public void parseUndefined() throws Exception {
BSONObject o = new BasicBSONObject();
o.put("Undefined", new Object());
o.put("Int32", 5);
BSONEncoder enc = new BasicBSONEncoder() {
@Override
protected boolean putSpecial(String name, Object o) {
putUndefined(name);
return true;
}
};
byte[] b = enc.encode(o);
ByteArrayInputStream bais = new ByteArrayInputStream(b);
ObjectMapper mapper = new ObjectMapper(new BsonFactory());
Map<?, ?> data = mapper.readValue(bais, Map.class);
assertEquals(1, data.size());
assertEquals(5, data.get("Int32"));