use of com.amplifyframework.datastore.appsync.AppSyncMocking.SyncConfigurator in project amplify-android by aws-amplify.
the class AppSyncMockingTest method mockFailureForSync.
/**
* When mockFailure() is called on the SyncConfigurator, the AppSync mock
* will emit the provided failure.
* @throws DataStoreException On failure to get a SyncConfigurator via sync()
*/
@Test
public void mockFailureForSync() throws DataStoreException {
DataStoreException failure = new DataStoreException("Foo", "Bar");
AppSyncMocking.sync(appSync).mockFailure(failure);
GraphQLRequest<PaginatedResult<ModelWithMetadata<BlogOwner>>> request = appSync.buildSyncRequest(schema, null, 100, QueryPredicates.all());
Single.create(emitter -> appSync.sync(request, emitter::onSuccess, emitter::onError)).test().awaitDone(TIMEOUT_SECONDS, TimeUnit.SECONDS).assertError(failure);
}
Aggregations