use of org.molgenis.api.metadata.v3.model.ReadAttributesRequest in project molgenis by molgenis.
the class MetadataApiControllerTest method testGetAttributes.
@Test
void testGetAttributes() {
String entityTypeId = "MyEntityTypeId";
Query query = mock(Query.class);
Sort sort = mock(Sort.class);
int size = 1;
int page = 2;
ReadAttributesRequest readAttributesRequest = new ReadAttributesRequest();
readAttributesRequest.setQ(query);
readAttributesRequest.setSort(sort);
readAttributesRequest.setSize(size);
readAttributesRequest.setPage(page);
Attributes attributes = mock(Attributes.class);
when(metadataApiService.findAttributes(entityTypeId, query, sort, size, page)).thenReturn(attributes);
AttributesResponse attributesResponse = mock(AttributesResponse.class);
when(attributeResponseMapper.toAttributesResponse(attributes, size, page)).thenReturn(attributesResponse);
assertEquals(attributesResponse, metadataApiController.getAttributes(entityTypeId, readAttributesRequest));
}
Aggregations