### Question:
Delta { public final boolean validate(@Nonnull final Version previous, @Nonnull final Version current) { if (previous == null) { throw new IllegalArgumentException("null previous"); } if (current == null) { throw new IllegalArgumentException("null current"); } if (current.compareTo(previous) <= 0) { throw new IllegalArgumentException("Current version <"+previous+"> must be more recent than previous version <"+current+">."); } if (current.isInDevelopment()) { return true; } final Version inferredVersion = infer(previous); return current.toReleaseVersion().compareTo(inferredVersion) >= 0; } Delta(@Nonnull final Set<? extends Difference> differences); @Nonnull final Set<Difference> getDifferences(); @Nonnull final CompatibilityType computeCompatibilityType(); @Nonnull static Version inferNextVersion(@Nonnull final Version version, @Nonnull final CompatibilityType compatibilityType); @Nonnull final Version infer(@Nonnull final Version previous); final boolean validate(@Nonnull final Version previous, @Nonnull final Version current);  }### Answer:
@Test(expected=IllegalArgumentException.class) public void shouldValidateWithNullPreviousVersionFail() { new Delta(EMPTY_DIFFERENCES).validate(null, new Version(1, 0, 0)); }
@Test(expected=IllegalArgumentException.class) public void shouldValidateWithNullCurrentVersionFail() { new Delta(EMPTY_DIFFERENCES).validate(new Version(1, 0, 0), null); }
@Test public void shouldValidateWithCurrentVersionInDevelopmentSucceed() { validate(EMPTY_DIFFERENCES, new Version(0, 0, 0), new Version(0, 0, 1), true); }
@Test(expected=IllegalArgumentException.class) public void shouldValidateWithPreviousVersionNextCurrentVersionFail() { new Delta(EMPTY_DIFFERENCES).validate(new Version(1, 1, 0), new Version(1, 0, 0)); }
@Test(expected=IllegalArgumentException.class) public void shouldValidateWithPreviousVersionEqualsCurrentVersionFail() { new Delta(EMPTY_DIFFERENCES).validate(new Version(1, 0, 0), new Version(1, 0, 0)); }
@Test public void shouldValidateWithCorrectVersionsSucceed() { validate(EMPTY_DIFFERENCES, new Version(1, 1, 0), new Version(1, 1, 1), true); }
@Test public void shouldValidateWithCorrectPreVersionsSucceed() { validate(EMPTY_DIFFERENCES, new Version(1, 1, 0, "-", "rc1"), new Version(1, 1, 0, "-", "rc2"), true); }
@Test public void shouldValidateWithIncorrectVersionFail() { validate(Collections.singleton(new Delta.Remove("class", new FieldInfo(0, "", "", "", null))), new Version(1, 1, 0), new Version(1, 1, 1), false); }
@Test public void upgradeMinorVersionOnClassDeprecated() { validate(singleton(new Delta.Deprecate("class", new ClassInfo(1, 0, "", "", "", null, null, null), new ClassInfo(1, 0, "", "", "", null, null, null))), new Version(1, 1, 0), new Version(1, 2, 0), true); }
@Test public void upgradeMinorVersionOnFieldDeprecated() { validate(singleton(new Delta.Deprecate("class", new FieldInfo(0, "", "", "", null), new FieldInfo(0, "", "", "", null))), new Version(1, 1, 0), new Version(1, 2, 0), true); }
@Test public void upgradeMinorVersionOnMethodDeprecated() { validate(singleton(new Delta.Deprecate("class", new MethodInfo(0, "", "", "", null), new MethodInfo(0, "", "", "", null))), new Version(1, 1, 0), new Version(1, 2, 0), true); }