@Test public void testImageOlder() { Image current = mock(Image.class); Image candidate = mock(Image.class); MutableObject<String> reason = new MutableObject<>(); when(current.getCreated()).thenReturn(2L); when(candidate.getCreated()).thenReturn(1L); Predicate<Image> predicate = underTest.filterPreviousImages(current, reason); boolean result = predicate.test(candidate); assertFalse(result); assertReason(reason); }
public Predicate<Image> filterPreviousImages(Image currentImage, Mutable<String> reason) { return candidate -> { reason.setValue("There are no newer images available than " + currentImage.getDate() + "."); return isDifferentVersion(currentImage, candidate) || isNewerOrSameCreationImage(currentImage, candidate); }; }
ImageCreationBasedFilter { public Predicate<Image> filterPreviousImages(Image currentImage, Mutable<String> reason) { return candidate -> { reason.setValue("There are no newer images available than " + currentImage.getDate() + "."); return isDifferentVersion(currentImage, candidate) || isNewerOrSameCreationImage(currentImage, candidate); }; } }
ImageCreationBasedFilter { public Predicate<Image> filterPreviousImages(Image currentImage, Mutable<String> reason) { return candidate -> { reason.setValue("There are no newer images available than " + currentImage.getDate() + "."); return isDifferentVersion(currentImage, candidate) || isNewerOrSameCreationImage(currentImage, candidate); }; }  }
ImageCreationBasedFilter { public Predicate<Image> filterPreviousImages(Image currentImage, Mutable<String> reason) { return candidate -> { reason.setValue("There are no newer images available than " + currentImage.getDate() + "."); return isDifferentVersion(currentImage, candidate) || isNewerOrSameCreationImage(currentImage, candidate); }; }  Predicate<Image> filterPreviousImages(Image currentImage, Mutable<String> reason); }
ImageCreationBasedFilter { public Predicate<Image> filterPreviousImages(Image currentImage, Mutable<String> reason) { return candidate -> { reason.setValue("There are no newer images available than " + currentImage.getDate() + "."); return isDifferentVersion(currentImage, candidate) || isNewerOrSameCreationImage(currentImage, candidate); }; }  Predicate<Image> filterPreviousImages(Image currentImage, Mutable<String> reason);  }