@Test public void testAvailabilityFilter() { // given SortedSet<ProgramSettings> programsSettings = getProgramsSettings(); SortedSet<Program> installationData = getInstallationData(); EnvironmentData environmentData = new EnvironmentData(null, programsSettings); environmentData.setInstallationsData(installationData); // when SortedSet<Program> registeredPrograms = new AvailabilityFilter(environmentData).getRegisteredPrograms(); // then assertThat(registeredPrograms) .as("Constructor should properly obtain registered programs") .isNotNull() .hasSize(1) .isEqualTo(getRegisteredPrograms(programsSettings, installationData)); }
@Test public void testFindAvailableToInstallForExistingPrograms() { // given SortedSet<ProgramSettings> programsSettings = getProgramsSettings(); SortedSet<Program> installationData = getInstallationData(); EnvironmentData environmentData = new EnvironmentData(null, programsSettings); environmentData.setInstallationsData(installationData); // when SortedSet<Program> availableToInstall = new AvailabilityFilter(environmentData) .findProgramsAvailableToInstallOrInstalledWithDefinedSettings( getProgramsAvailableOnServers()); // then assertThat(availableToInstall) .as( "availableToInstall(SortedSet<Program>) should remove program installed but not available on servers, and add programs available on servers but not installed") .isNotNull() .hasSize(1); }