Merge pull request #12067 from hkhan/JAVA-11252-fix-mongodb-live-tests

[JAVA-11252] Fix Mongodb live test
This commit is contained in:
kwoyke 2022-04-15 10:13:54 +02:00 committed by GitHub
commit bc979b2c0d

View File

@ -38,7 +38,7 @@ public class BsonToJsonLiveTest {
.setAuthor("author") .setAuthor("author")
.setCost(3.95) .setCost(3.95)
.setPublisher(new Publisher(new ObjectId("fffffffffffffffffffffffa"),"publisher")) .setPublisher(new Publisher(new ObjectId("fffffffffffffffffffffffa"),"publisher"))
.setPublishDate(LocalDateTime.parse("2020-01-01T18:13:32Z", DateTimeFormatter.ISO_DATE_TIME)) .setPublishDate(LocalDateTime.parse("2020-01-01T17:13:32Z", DateTimeFormatter.ISO_DATE_TIME))
.addCompanionBooks(new Book().setIsbn("isbn2"))); .addCompanionBooks(new Book().setIsbn("isbn2")));
} }
@ -50,7 +50,7 @@ public class BsonToJsonLiveTest {
@Test @Test
public void givenBsonDocument_whenUsingStandardJsonTransformation_thenJsonDateIsObjectEpochTime() { public void givenBsonDocument_whenUsingStandardJsonTransformation_thenJsonDateIsObjectEpochTime() {
String json = null; String json;
try (MongoClient mongoClient = new MongoClient()) { try (MongoClient mongoClient = new MongoClient()) {
MongoDatabase mongoDatabase = mongoClient.getDatabase(DB_NAME); MongoDatabase mongoDatabase = mongoClient.getDatabase(DB_NAME);
Document bson = mongoDatabase.getCollection("Books").find().first(); Document bson = mongoDatabase.getCollection("Books").find().first();
@ -75,7 +75,7 @@ public class BsonToJsonLiveTest {
@Test @Test
public void givenBsonDocument_whenUsingRelaxedJsonTransformation_thenJsonDateIsObjectIsoDate() { public void givenBsonDocument_whenUsingRelaxedJsonTransformation_thenJsonDateIsObjectIsoDate() {
String json = null; String json;
try (MongoClient mongoClient = new MongoClient()) { try (MongoClient mongoClient = new MongoClient()) {
MongoDatabase mongoDatabase = mongoClient.getDatabase(DB_NAME); MongoDatabase mongoDatabase = mongoClient.getDatabase(DB_NAME);
Document bson = mongoDatabase.getCollection("Books").find().first(); Document bson = mongoDatabase.getCollection("Books").find().first();
@ -102,7 +102,7 @@ public class BsonToJsonLiveTest {
@Test @Test
public void givenBsonDocument_whenUsingCustomJsonTransformation_thenJsonDateIsStringField() { public void givenBsonDocument_whenUsingCustomJsonTransformation_thenJsonDateIsStringField() {
String json = null; String json;
try (MongoClient mongoClient = new MongoClient()) { try (MongoClient mongoClient = new MongoClient()) {
MongoDatabase mongoDatabase = mongoClient.getDatabase(DB_NAME); MongoDatabase mongoDatabase = mongoClient.getDatabase(DB_NAME);
Document bson = mongoDatabase.getCollection("Books").find().first(); Document bson = mongoDatabase.getCollection("Books").find().first();