@Test
public void testResultParse() throws InvalidFieldException {
BSONObject result = new BasicBSONObject();
result.put("RowsAffected", UnsignedLong.valueOf("12"));
result.put("InsertId", UnsignedLong.valueOf("12345"));
BasicBSONList fields = new BasicBSONList();
for (long l = 0; l < 4; l++) {
BSONObject field = new BasicBSONObject();
field.put("Name", ("col_" + l).getBytes());
field.put("Type", l);
fields.add(field);
}
result.put("Fields", fields);
BasicBSONList rows = new BasicBSONList();
for (int i = 0; i < 3; i++) {
BasicBSONList row = new BasicBSONList();
row.add(new Double(i).toString().getBytes());
row.add(String.valueOf(i).getBytes());
row.add(String.valueOf(i).getBytes());
row.add(new Long(i).toString().getBytes());
rows.add(row);
}
result.put("Rows", rows);
QueryResult qr = Bsonify.bsonToQueryResult(result, null);