ScenarioSimulationKogitoRuntimeCreationAssetsDropdownProviderImpl implements ScenarioSimulationKogitoCreationAssetsDropdownProvider { protected KieAssetsDropdownItem getKieAssetsDropdownItem(final String fullPath) { int idx = fullPath.replaceAll("\\\\", "/").lastIndexOf('/'); final String fileName = idx >= 0 ? fullPath.substring(idx + 1) : fullPath; return new KieAssetsDropdownItem(fileName, fullPath, fullPath, new HashMap<>()); }  @Override void getItems(Consumer<List<KieAssetsDropdownItem>> assetListConsumer);  }
@Test public void getKieAssetsDropdownItemFileWithoutPath() { String fullPath = "filename.etc"; KieAssetsDropdownItem item = scenarioSimulationKogitoRuntimeCreationAssetsDropdownProviderImplSpy.getKieAssetsDropdownItem(fullPath); assertNotNull(item); assertEquals(fullPath, item.getValue()); assertEquals(fullPath, item.getSubText()); assertEquals(fullPath, item.getText()); }
@Test public void getKieAssetsDropdownItemFileWithPath() { String path = "path/"; String fileName = "filename.etc"; String fullPath = path + fileName; KieAssetsDropdownItem item = scenarioSimulationKogitoRuntimeCreationAssetsDropdownProviderImplSpy.getKieAssetsDropdownItem(fullPath); assertNotNull(item); assertEquals(fullPath, item.getValue()); assertEquals(fullPath, item.getSubText()); assertEquals(fileName, item.getText()); }
@Test public void getKieAssetsDropdownItemFileWithLongPath() { String path = "long/path/"; String fileName = "filename.etc"; String fullPath = path + fileName; KieAssetsDropdownItem item = scenarioSimulationKogitoRuntimeCreationAssetsDropdownProviderImplSpy.getKieAssetsDropdownItem(fullPath); assertNotNull(item); assertEquals(fullPath, item.getValue()); assertEquals(fullPath, item.getSubText()); assertEquals(fileName, item.getText()); }
@Test public void getKieAssetsDropdownItemFileWithPathWindows() { String path = "path\\"; String fileName = "filename.etc"; String fullPath = path + fileName; KieAssetsDropdownItem item = scenarioSimulationKogitoRuntimeCreationAssetsDropdownProviderImplSpy.getKieAssetsDropdownItem(fullPath); assertNotNull(item); assertEquals(fullPath, item.getValue()); assertEquals(fullPath, item.getSubText()); assertEquals(fileName, item.getText()); }
@Test public void getKieAssetsDropdownItemFileWithLongPathWindows() { String path = "long\\pat\\"; String fileName = "filename.etc"; String fullPath = path + fileName; KieAssetsDropdownItem item = scenarioSimulationKogitoRuntimeCreationAssetsDropdownProviderImplSpy.getKieAssetsDropdownItem(fullPath); assertNotNull(item); assertEquals(fullPath, item.getValue()); assertEquals(fullPath, item.getSubText()); assertEquals(fileName, item.getText()); }