Skip to content

Commit 526e72a

Browse files
committed
remove use of synchronous datastore in a test
1 parent be87fed commit 526e72a

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

aws-datastore/src/test/java/com/amplifyframework/datastore/ConflictResolverIntegrationTest.java

+11-4
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,17 @@ public void conflictIsResolvedByRetryingLocalData() throws AmplifyException, JSO
127127
Amplify.Hub.publish(HubChannel.DATASTORE, HubEvent.create(InitializationStatus.SUCCEEDED));
128128

129129
// Save person 1
130-
synchronousDataStore.save(person1);
131-
Person result1 = synchronousDataStore.get(Person.class, person1.getId());
132-
assertTrue(latch.await(7, TimeUnit.SECONDS));
133-
assertEquals(person1, result1);
130+
Consumer<DataStoreItemChange<Person>> onSuccess = (Consumer) value -> {
131+
try {
132+
Person result1 = synchronousDataStore.get(Person.class, person1.getId());
133+
assertTrue(latch.await(7, TimeUnit.SECONDS));
134+
assertEquals(person1, result1);
135+
} catch (Exception error) {
136+
throw new RuntimeException(error);
137+
}
138+
};
139+
Consumer<DataStoreException> onError = (Consumer) value -> fail("awsDataStorePlugin.save: onError");
140+
awsDataStorePlugin.save(person1, onSuccess, onError);
134141
}
135142

136143
@SuppressWarnings("unchecked")

0 commit comments

Comments
 (0)