@Test(expected=IllegalArgumentException.class) public void shouldInferWithNullVersionFail() { inferNextVersion(null, BACKWARD_COMPATIBLE_IMPLEMENTER); }
@Nonnull public static Version inferNextVersion(@Nonnull final Version version, @Nonnull final CompatibilityType compatibilityType) { if (version == null) { throw new IllegalArgumentException("null version"); } if (compatibilityType == null) { throw new IllegalArgumentException("null compatibilityType"); } switch (compatibilityType) { case BACKWARD_COMPATIBLE_IMPLEMENTER: return version.next(Version.Element.PATCH); case BACKWARD_COMPATIBLE_USER: return version.next(Version.Element.MINOR); case NON_BACKWARD_COMPATIBLE: return version.next(Version.Element.MAJOR); default: throw new IllegalArgumentException("Unknown type <"+compatibilityType+">"); } }
Delta { @Nonnull public static Version inferNextVersion(@Nonnull final Version version, @Nonnull final CompatibilityType compatibilityType) { if (version == null) { throw new IllegalArgumentException("null version"); } if (compatibilityType == null) { throw new IllegalArgumentException("null compatibilityType"); } switch (compatibilityType) { case BACKWARD_COMPATIBLE_IMPLEMENTER: return version.next(Version.Element.PATCH); case BACKWARD_COMPATIBLE_USER: return version.next(Version.Element.MINOR); case NON_BACKWARD_COMPATIBLE: return version.next(Version.Element.MAJOR); default: throw new IllegalArgumentException("Unknown type <"+compatibilityType+">"); } } }
Delta { @Nonnull public static Version inferNextVersion(@Nonnull final Version version, @Nonnull final CompatibilityType compatibilityType) { if (version == null) { throw new IllegalArgumentException("null version"); } if (compatibilityType == null) { throw new IllegalArgumentException("null compatibilityType"); } switch (compatibilityType) { case BACKWARD_COMPATIBLE_IMPLEMENTER: return version.next(Version.Element.PATCH); case BACKWARD_COMPATIBLE_USER: return version.next(Version.Element.MINOR); case NON_BACKWARD_COMPATIBLE: return version.next(Version.Element.MAJOR); default: throw new IllegalArgumentException("Unknown type <"+compatibilityType+">"); } } Delta(@Nonnull final Set<? extends Difference> differences); }
Delta { @Nonnull public static Version inferNextVersion(@Nonnull final Version version, @Nonnull final CompatibilityType compatibilityType) { if (version == null) { throw new IllegalArgumentException("null version"); } if (compatibilityType == null) { throw new IllegalArgumentException("null compatibilityType"); } switch (compatibilityType) { case BACKWARD_COMPATIBLE_IMPLEMENTER: return version.next(Version.Element.PATCH); case BACKWARD_COMPATIBLE_USER: return version.next(Version.Element.MINOR); case NON_BACKWARD_COMPATIBLE: return version.next(Version.Element.MAJOR); default: throw new IllegalArgumentException("Unknown type <"+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 static Version inferNextVersion(@Nonnull final Version version, @Nonnull final CompatibilityType compatibilityType) { if (version == null) { throw new IllegalArgumentException("null version"); } if (compatibilityType == null) { throw new IllegalArgumentException("null compatibilityType"); } switch (compatibilityType) { case BACKWARD_COMPATIBLE_IMPLEMENTER: return version.next(Version.Element.PATCH); case BACKWARD_COMPATIBLE_USER: return version.next(Version.Element.MINOR); case NON_BACKWARD_COMPATIBLE: return version.next(Version.Element.MAJOR); default: throw new IllegalArgumentException("Unknown type <"+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);  }