ExportSummaryWizardPage implements WizardPage { void remapMissingDependencies(Map<String, List<String>> validation) { if (assets == null) { return; } List<DataSetDef> datasets = assets.getDatasetsDefinitions(); validation.replaceAll((page, deps) -> { return deps.stream() .map(uuid -> datasets.stream() .filter(ds -> ds.getUUID().equals(uuid)) .map(ds -> ds.getName()).findAny().orElse(uuid)) .collect(toList()); }); }  @PostConstruct void init(); @Override Widget asWidget(); @Override String getTitle(); @Override void isComplete(Callback<Boolean> callback); @Override void initialise(); @Override void prepareView(); void setGoToDataSetsCommand(Command goToDatasets); void setGoToPagesCommand(Command goToPages); void setExportSummary(Supplier<DataTransferExportModel> exportModelSupplier); void setCallback(ParameterizedCommand<DataTransferExportModel> dataTransferExportModelCallback); void goToDataSetsPage(); void goToPagesPage(); void setAssets(DataTransferAssets assets);  }
@Test public void testRemapMissingDependencies() { String UUID = "uuid"; String NAME = "name"; String PAGE = "page"; DataSetDef def1 = new DataSetDef(); def1.setUUID(UUID); def1.setName(NAME); HashMap<String, List<String>> validation = new HashMap<>(); validation.put(PAGE, Collections.singletonList(UUID)); DataTransferAssets assets = new DataTransferAssets(Collections.singletonList(def1), Collections.emptyList()); exportWizardSummaryPage.setAssets(assets); exportWizardSummaryPage.remapMissingDependencies(validation); assertEquals(NAME, validation.get(PAGE).get(0)); }
@Test public void testRemapMissingDependenciesWithoutDatasetDef() { String UUID = "uuid"; String PAGE = "page"; HashMap<String, List<String>> validation = new HashMap<>(); validation.put(PAGE, Collections.singletonList(UUID)); exportWizardSummaryPage.remapMissingDependencies(validation); assertEquals(UUID, validation.get(PAGE).get(0)); }