Search in sources :

Example 1 with ReadEntityTypesRequest

use of org.molgenis.api.metadata.v3.model.ReadEntityTypesRequest in project molgenis by molgenis.

the class MetadataApiControllerTest method testGetEntityTypes.

@Test
void testGetEntityTypes() {
    int page = 2;
    int size = 1;
    Sort sort = mock(Sort.class);
    Query query = mock(Query.class);
    ReadEntityTypesRequest readEntityTypesRequest = new ReadEntityTypesRequest();
    readEntityTypesRequest.setPage(page);
    readEntityTypesRequest.setSize(size);
    readEntityTypesRequest.setSort(sort);
    readEntityTypesRequest.setQ(query);
    EntityTypes entityTypes = mock(EntityTypes.class);
    when(metadataApiService.findEntityTypes(query, sort, size, page)).thenReturn(entityTypes);
    EntityTypesResponse entityTypesResponse = mock(EntityTypesResponse.class);
    when(entityTypeResponseMapper.toEntityTypesResponse(entityTypes, size, page)).thenReturn(entityTypesResponse);
    assertEquals(entityTypesResponse, metadataApiController.getEntityTypes(readEntityTypesRequest));
}
Also used : EntityTypesResponse(org.molgenis.api.metadata.v3.model.EntityTypesResponse) Query(org.molgenis.api.model.Query) Sort(org.molgenis.api.model.Sort) ReadEntityTypesRequest(org.molgenis.api.metadata.v3.model.ReadEntityTypesRequest) Test(org.junit.jupiter.api.Test) AbstractMockitoTest(org.molgenis.test.AbstractMockitoTest)

Aggregations

Test (org.junit.jupiter.api.Test)1 EntityTypesResponse (org.molgenis.api.metadata.v3.model.EntityTypesResponse)1 ReadEntityTypesRequest (org.molgenis.api.metadata.v3.model.ReadEntityTypesRequest)1 Query (org.molgenis.api.model.Query)1 Sort (org.molgenis.api.model.Sort)1 AbstractMockitoTest (org.molgenis.test.AbstractMockitoTest)1