@Test public void shouldDeltaWithChangesBeNonBackwardCompatible() { final int major = 1; final int minor = 2; final int patch = 3; final Version version = new Version(major, minor, patch); final Version inferedVersion = new Delta(Collections.singleton(new Delta.Change("class", new FieldInfo(0, "", "", "", null), new FieldInfo(0, "", "", "", null)))).infer(version); assertEquals(new Version(major+1, 0, 0), inferedVersion); }
@Nonnull public final Version infer(@Nonnull final Version previous) { if (previous == null) { throw new IllegalArgumentException("null previous"); } if (previous.isInDevelopment()) { throw new IllegalArgumentException("Cannot infer for in development version <"+previous+">"); } final CompatibilityType compatibilityType = computeCompatibilityType(); return inferNextVersion(previous, compatibilityType); }
Delta { @Nonnull public final Version infer(@Nonnull final Version previous) { if (previous == null) { throw new IllegalArgumentException("null previous"); } if (previous.isInDevelopment()) { throw new IllegalArgumentException("Cannot infer for in development version <"+previous+">"); } final CompatibilityType compatibilityType = computeCompatibilityType(); return inferNextVersion(previous, compatibilityType); } }
Delta { @Nonnull public final Version infer(@Nonnull final Version previous) { if (previous == null) { throw new IllegalArgumentException("null previous"); } if (previous.isInDevelopment()) { throw new IllegalArgumentException("Cannot infer for in development version <"+previous+">"); } final CompatibilityType compatibilityType = computeCompatibilityType(); return inferNextVersion(previous, compatibilityType); } Delta(@Nonnull final Set<? extends Difference> differences); }
Delta { @Nonnull public final Version infer(@Nonnull final Version previous) { if (previous == null) { throw new IllegalArgumentException("null previous"); } if (previous.isInDevelopment()) { throw new IllegalArgumentException("Cannot infer for in development version <"+previous+">"); } final CompatibilityType compatibilityType = computeCompatibilityType(); return inferNextVersion(previous, compatibilityType); } 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); }
Delta { @Nonnull public final Version infer(@Nonnull final Version previous) { if (previous == null) { throw new IllegalArgumentException("null previous"); } if (previous.isInDevelopment()) { throw new IllegalArgumentException("Cannot infer for in development version <"+previous+">"); } final CompatibilityType compatibilityType = computeCompatibilityType(); return inferNextVersion(previous, compatibilityType); } 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);  }