ScenarioSimulationKogitoRuntimeCreationAssetsDropdownProviderImpl implements ScenarioSimulationKogitoCreationAssetsDropdownProvider { protected RemoteCallback<List<String>> getRemoteCallback(Consumer<List<KieAssetsDropdownItem>> assetListConsumer) { return response -> { List<KieAssetsDropdownItem> toAccept = response.stream() .map(this::getKieAssetsDropdownItem) .sorted(Comparator.comparing(KieAssetsDropdownItem::getText, String.CASE_INSENSITIVE_ORDER)) .collect(Collectors.toList()); assetListConsumer.accept(toAccept); }; }  @Override void getItems(Consumer<List<KieAssetsDropdownItem>> assetListConsumer);  }
@Test public void getRemoteCallBack() { RemoteCallback<List<String>> remoteCallBack = scenarioSimulationKogitoRuntimeCreationAssetsDropdownProviderImplSpy.getRemoteCallback(assetConsumer); remoteCallBack.callback(Arrays.asList("path/B", "a")); verify(assetConsumer, times(1)).accept(dropDownListCaptor.capture()); assertTrue(dropDownListCaptor.getValue().size() == 2); assertEquals("a", dropDownListCaptor.getValue().get(0).getText()); assertEquals("a", dropDownListCaptor.getValue().get(0).getSubText()); assertEquals("a", dropDownListCaptor.getValue().get(0).getValue()); assertEquals("B", dropDownListCaptor.getValue().get(1).getText()); assertEquals("path/B", dropDownListCaptor.getValue().get(1).getSubText()); assertEquals("path/B", dropDownListCaptor.getValue().get(1).getValue()); }
@Test public void remoteCallBackSortedIgnoreCase(){ RemoteCallback<List<String>> remoteCallBack = scenarioSimulationKogitoRuntimeCreationAssetsDropdownProviderImplSpy.getRemoteCallback(assetConsumer); List<String> dmnFiles = Arrays.asList("AS", "Ap"); remoteCallBack.callback(dmnFiles); verify(assetConsumer, times(1)).accept(dropDownListCaptor.capture()); Collections.sort(dmnFiles, String::compareToIgnoreCase); assertEquals(dmnFiles, dropDownListCaptor.getValue().stream().map(KieAssetsDropdownItem::getValue).collect(Collectors.toList())); }