Search in sources :

Example 1 with DataServiceImpl

use of org.molgenis.data.support.DataServiceImpl in project molgenis by molgenis.

the class DataServiceImplTest method beforeMethod.

@SuppressWarnings("unchecked")
@BeforeMethod
public void beforeMethod() {
    dataService = new DataServiceImpl();
    repo1 = when(mock(Repository.class).getName()).thenReturn("Entity1").getMock();
    repo2 = mock(Repository.class);
    repo2 = when(mock(Repository.class).getName()).thenReturn("Entity2").getMock();
    repoToRemove = mock(Repository.class);
    repoToRemove = when(mock(Repository.class).getName()).thenReturn("Entity3").getMock();
    metaDataService = mock(MetaDataService.class);
    when(metaDataService.getRepository("Entity1")).thenReturn(repo1);
    when(metaDataService.getRepository("Entity2")).thenReturn(repo2);
    when(metaDataService.getRepository("Entity3")).thenReturn(repoToRemove);
    EntityType entityType1 = when(mock(EntityType.class).getId()).thenReturn("Entity1").getMock();
    EntityType entityType2 = when(mock(EntityType.class).getId()).thenReturn("Entity2").getMock();
    EntityType entityType3 = when(mock(EntityType.class).getId()).thenReturn("Entity3").getMock();
    when(metaDataService.getEntityTypes()).thenAnswer(invocation -> Stream.of(entityType1, entityType2, entityType3));
    dataService.setMetaDataService(metaDataService);
}
Also used : EntityType(org.molgenis.data.meta.model.EntityType) MetaDataService(org.molgenis.data.meta.MetaDataService) DataServiceImpl(org.molgenis.data.support.DataServiceImpl) BeforeMethod(org.testng.annotations.BeforeMethod)

Aggregations

MetaDataService (org.molgenis.data.meta.MetaDataService)1 EntityType (org.molgenis.data.meta.model.EntityType)1 DataServiceImpl (org.molgenis.data.support.DataServiceImpl)1 BeforeMethod (org.testng.annotations.BeforeMethod)1