Search in sources :

Example 1 with ReadEntityTypeRequest

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

the class MetadataApiControllerTest method testGetEntityType.

@Test
void testGetEntityType() {
    String entityTypeId = "MyEntityTypeId";
    boolean flattenAttrs = true;
    boolean i18n = false;
    ReadEntityTypeRequest readEntityTypeRequest = new ReadEntityTypeRequest();
    readEntityTypeRequest.setFlattenAttributes(flattenAttrs);
    readEntityTypeRequest.setI18n(i18n);
    EntityType entityType = mock(EntityType.class);
    when(metadataApiService.findEntityType(entityTypeId)).thenReturn(entityType);
    EntityTypeResponse entityTypeResponse = mock(EntityTypeResponse.class);
    when(entityTypeResponseMapper.toEntityTypeResponse(entityType, flattenAttrs, i18n)).thenReturn(entityTypeResponse);
    assertEquals(entityTypeResponse, metadataApiController.getEntityType(entityTypeId, readEntityTypeRequest));
}
Also used : EntityType(org.molgenis.data.meta.model.EntityType) EntityTypeResponse(org.molgenis.api.metadata.v3.model.EntityTypeResponse) ReadEntityTypeRequest(org.molgenis.api.metadata.v3.model.ReadEntityTypeRequest) Test(org.junit.jupiter.api.Test) AbstractMockitoTest(org.molgenis.test.AbstractMockitoTest)

Aggregations

Test (org.junit.jupiter.api.Test)1 EntityTypeResponse (org.molgenis.api.metadata.v3.model.EntityTypeResponse)1 ReadEntityTypeRequest (org.molgenis.api.metadata.v3.model.ReadEntityTypeRequest)1 EntityType (org.molgenis.data.meta.model.EntityType)1 AbstractMockitoTest (org.molgenis.test.AbstractMockitoTest)1