@Test public void testCompareShouldReturnFalseWhenTheNewBuildNumberIsNotPresent() { Image currentImage = createImage("1234"); Image newImage = createImage(null); boolean actual = underTest.compare(currentImage, newImage, BUILD_NUMBER_KEY); assertFalse(actual); }
boolean compare(Image currentImage, Image newImage, String buildNumberKey) { Optional<String> currentVersion = getBuildVersion(currentImage, buildNumberKey); Optional<String> newVersion = getBuildVersion(newImage, buildNumberKey); return currentVersion.isPresent() && newVersion.isPresent() && compare(currentVersion, newVersion); }
ComponentBuildNumberComparator { boolean compare(Image currentImage, Image newImage, String buildNumberKey) { Optional<String> currentVersion = getBuildVersion(currentImage, buildNumberKey); Optional<String> newVersion = getBuildVersion(newImage, buildNumberKey); return currentVersion.isPresent() && newVersion.isPresent() && compare(currentVersion, newVersion); } }
ComponentBuildNumberComparator { boolean compare(Image currentImage, Image newImage, String buildNumberKey) { Optional<String> currentVersion = getBuildVersion(currentImage, buildNumberKey); Optional<String> newVersion = getBuildVersion(newImage, buildNumberKey); return currentVersion.isPresent() && newVersion.isPresent() && compare(currentVersion, newVersion); }  }
ComponentBuildNumberComparator { boolean compare(Image currentImage, Image newImage, String buildNumberKey) { Optional<String> currentVersion = getBuildVersion(currentImage, buildNumberKey); Optional<String> newVersion = getBuildVersion(newImage, buildNumberKey); return currentVersion.isPresent() && newVersion.isPresent() && compare(currentVersion, newVersion); }   }
ComponentBuildNumberComparator { boolean compare(Image currentImage, Image newImage, String buildNumberKey) { Optional<String> currentVersion = getBuildVersion(currentImage, buildNumberKey); Optional<String> newVersion = getBuildVersion(newImage, buildNumberKey); return currentVersion.isPresent() && newVersion.isPresent() && compare(currentVersion, newVersion); }    }