use of com.google.cloud.firestore.LocalFirestoreHelper.AllSupportedTypes in project java-firestore by googleapis.
the class ITSystemTest method updateDocument.
@Test
public void updateDocument() throws Exception {
AllSupportedTypes expectedResult = new AllSupportedTypes();
WriteResult writeResult = randomDoc.set(ALL_SUPPORTED_TYPES_MAP).get();
DocumentSnapshot documentSnapshot = randomDoc.get().get();
assertEquals(expectedResult, documentSnapshot.toObject(AllSupportedTypes.class));
randomDoc.update(Precondition.updatedAt(writeResult.getUpdateTime()), "foo", "updated").get();
documentSnapshot = randomDoc.get().get();
expectedResult.foo = "updated";
assertEquals(expectedResult, documentSnapshot.toObject(AllSupportedTypes.class));
expectedResult.model = ImmutableMap.of("foo", UPDATE_SINGLE_FIELD_OBJECT.foo);
randomDoc.update("model", UPDATE_SINGLE_FIELD_OBJECT).get();
documentSnapshot = randomDoc.get().get();
assertEquals(expectedResult, documentSnapshot.toObject(AllSupportedTypes.class));
}
Aggregations