use of org.molgenis.oneclickimporter.service.impl.OneClickImporterNamingServiceImpl in project molgenis by molgenis.
the class OneClickImporterNamingServiceTest method testGetLabelWithPostFixDuplicateInNoOrder.
@Test
public void testGetLabelWithPostFixDuplicateInNoOrder() {
EntityType e1 = Mockito.mock(EntityType.class);
when(e1.getLabel()).thenReturn("label");
EntityType e2 = Mockito.mock(EntityType.class);
when(e2.getLabel()).thenReturn("label (1)");
EntityType e3 = Mockito.mock(EntityType.class);
when(e3.getLabel()).thenReturn("label (3)");
String label = "label";
when(dataService.findAll(ENTITY_TYPE_META_DATA, new QueryImpl<EntityType>().like(LABEL, label), EntityType.class)).thenReturn(Stream.of(e1, e2, e3));
oneClickImporterNamingService = new OneClickImporterNamingServiceImpl(dataService);
String actual = oneClickImporterNamingService.getLabelWithPostFix(label);
String expected = "label (2)";
assertEquals(actual, expected);
}
Aggregations