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);
}
Aggregations