use of org.dotwebstack.framework.core.query.model.CollectionBatchRequest in project dotwebstack-framework by dotwebstack.
the class PostgresBackendLoaderTest method batchLoadMany_returnsFluxObject.
@Test
@Disabled("fix me")
void batchLoadMany_returnsFluxObject() {
FetchSpec fetchSpec = mock(FetchSpec.class);
when(fetchSpec.all()).thenReturn(Flux.just(Map.of("@@@", "ccc")));
DatabaseClient.GenericExecuteSpec spec = mock(DatabaseClient.GenericExecuteSpec.class);
when(spec.fetch()).thenReturn(fetchSpec);
when(databaseClient.sql(anyString())).thenReturn(spec);
PostgresObjectField objectFieldMock = mock(PostgresObjectField.class);
when(objectFieldMock.getJoinTable()).thenReturn(mock(JoinTable.class));
Map<String, Object> source = new HashMap<>();
source.put("a", "bbb");
RequestContext requestContext = RequestContext.builder().objectField(objectFieldMock).source(source).build();
ObjectRequest objectRequest = initObjectRequest();
CollectionRequest collectionRequest = CollectionRequest.builder().objectRequest(objectRequest).sortCriterias(List.of()).build();
CollectionBatchRequest request = CollectionBatchRequest.builder().collectionRequest(collectionRequest).joinCriteria(JoinCriteria.builder().build()).build();
var res = backendLoader.batchLoadMany(request, requestContext);
assertThat(res, CoreMatchers.is(notNullValue()));
}
Aggregations