Search in sources :

Example 1 with ReadEntityRequest

use of org.molgenis.api.data.v3.model.ReadEntityRequest in project molgenis by molgenis.

the class EntityControllerTest method testGetEntity.

@Test
void testGetEntity() {
    String entityTypeId = "MyEntityTypeId";
    String entityId = "MyId";
    Selection filter = Selection.FULL_SELECTION;
    Selection expand = Selection.FULL_SELECTION;
    ReadEntityRequest entityRequest = new ReadEntityRequest();
    entityRequest.setEntityTypeId(entityTypeId);
    entityRequest.setEntityId(entityId);
    entityRequest.setFilter(filter);
    entityRequest.setExpand(expand);
    Entity entity = mock(Entity.class);
    when(dataServiceV3.find(entityTypeId, entityId, filter, expand)).thenReturn(entity);
    EntityResponse entityResponse = mock(EntityResponse.class);
    when(entityMapper.map(entity, filter, expand)).thenReturn(entityResponse);
    assertEquals(entityResponse, entityController.getEntity(entityRequest));
}
Also used : ResponseEntity(org.springframework.http.ResponseEntity) Entity(org.molgenis.data.Entity) EntityResponse(org.molgenis.api.data.v3.model.EntityResponse) Selection(org.molgenis.api.model.Selection) ReadEntityRequest(org.molgenis.api.data.v3.model.ReadEntityRequest) Test(org.junit.jupiter.api.Test) AbstractMockitoTest(org.molgenis.test.AbstractMockitoTest)

Aggregations

Test (org.junit.jupiter.api.Test)1 EntityResponse (org.molgenis.api.data.v3.model.EntityResponse)1 ReadEntityRequest (org.molgenis.api.data.v3.model.ReadEntityRequest)1 Selection (org.molgenis.api.model.Selection)1 Entity (org.molgenis.data.Entity)1 AbstractMockitoTest (org.molgenis.test.AbstractMockitoTest)1 ResponseEntity (org.springframework.http.ResponseEntity)1