use of org.bson.BsonTimestamp in project mongo-java-driver by mongodb.
the class JsonWriterTest method testTimestampShell.
@Test
public void testTimestampShell() {
writer = new JsonWriter(stringWriter, JsonWriterSettings.builder().outputMode(JsonMode.SHELL).build());
writer.writeStartDocument();
writer.writeTimestamp("timestamp", new BsonTimestamp(1000, 1));
writer.writeEndDocument();
String expected = "{ \"timestamp\" : Timestamp(1000, 1) }";
assertEquals(expected, stringWriter.toString());
}
use of org.bson.BsonTimestamp in project mongo-java-driver by mongodb.
the class JsonReaderTest method testTimestampStrict.
@Test
public void testTimestampStrict() {
String json = "{ \"$timestamp\" : { \"t\" : 1234, \"i\" : 1 } }";
bsonReader = new JsonReader(json);
assertEquals(BsonType.TIMESTAMP, bsonReader.readBsonType());
assertEquals(new BsonTimestamp(1234, 1), bsonReader.readTimestamp());
assertEquals(AbstractBsonReader.State.DONE, bsonReader.getState());
}
Aggregations