Release Notes

AssertJ Guava main documentation is still in joel-costigliola.github.io/assertj/assertj-guava.html until it is moved to this website.

The latest release notes can be found in the GitHub releases.

Even older release notes can be found in the old site: joel-costigliola.github.io/assertj/assertj-guava.html#latest-release.

AssertJ Guava 3.5.0

Release date: 2022-06-11

Contributors

Thanks to all the contributors of this release: Erhard Pointl, Stefano Cordio, BJ Hargrave , sullis .

Binary compatibility

The release is binary compatible with the previous minor version.

Improvements

  • Remove <> from error messages (Erhard Pointl)

  • Internal: Add binary compatibility check of main against the latest release (Stefano Cordio)

  • Internal: Add binary compatibility checks for pull requests (Stefano Cordio)

  • Internal: Add Code of Conduct (Stefano Cordio)

  • Internal: Add CodeQL workflow (Stefano Cordio)

  • Internal: Add Dependabot (sullis)

  • Internal: Add release workflow (Stefano Cordio)

  • Internal: Bump actions/cache from v1 to v2

  • Internal: Bump actions/checkout from 2 to 3

  • Internal: Bump actions/setup-java from 1 to 3

  • Internal: Bump actions/upload-artifact from 2 to 3

  • Internal: Bump assertj-core from 3.15.0 to 3.23.1 (sullis, Erhard Pointl, Stefano Cordio)

  • Internal: Bump assertj-parent-pom from 2.2.6 to 2.2.17

  • Internal: Bump github/codeql-action from 1 to 2

  • Internal: Bump guava from 29.0-jre to 31.1-jre

  • Internal: Bump Maven version from 3.6.3 to 3.8.5 (Erhard Pointl, Stefano Cordio)

  • Internal: Bump maven-bundle-plugin from 3.0.1 to 5.1.4

  • Internal: Convert JUnit 4 tests to JUnit 5 (Stefano Cordio)

  • Internal: Move RangeSet assertions to the api package (Stefano Cordio)

  • Internal: Simplify maven-bundle-plugin configuration (Stefano Cordio)

  • Internal: Switch to the official Maven Wrapper by Apache (Stefano Cordio)

  • Internal: Update license headers (Erhard Pointl, Stefano Cordio)

  • Internal: Use bnd-maven-plugin instead of maven-bundle-plugin (BJ Hargrave)

Fixed

  • Remove the usage of assertj-core internal API to fix the compatibility with OSGi (Stefano Cordio)

AssertJ Guava 3.4.0

Release date: 2020-04-24

Contributors

Thanks to Ilya Koshaleu for its contribution!

New features

Add RangeSet assertions (Ilya Koshaleu):

  • contains(T…​ ranges): Verifies that the given RangeSet contains the given ranges.

  • containsAll(Iterable<T> ranges): Verifies that the given RangeSet contains all the given ranges.

  • containsAnyOf(T…​ ranges): Verifies that the given RangeSet contains at least one of the given ranges.

  • containsAnyRangesOf(Iterable<T> ranges): Verifies that the given RangeSet contains at least one of the given ranges.

  • doesNotContain(T…​ ranges): Verifies that the given RangeSet does not contain any of the given ranges.

  • doesNotContainAll(Iterable<T> ranges): Verifies that the given RangeSet does not contain any of the given ranges.

  • doesNotEnclose(Range<T>…​ ranges): Verifies that the given RangeSet does not enclose the given ranges.

  • doesNotEncloseAnyRangesOf(RangeSet<T> rangeSet): Verifies that the given RangeSet does not enclose any range from the given range set.

  • doesNotEncloseAnyRangesOf(Iterable<Range<T>> ranges): Verifies that the given RangeSet does not enclose any of the given ranges.

  • doesNotIntersect(Range<T>…​ ranges): Verifies that the given RangeSet does not intersect the given ranges.

  • doesNotIntersectAnyRangeFrom(RangeSet<T> rangeSet): Verifies that the given RangeSet does not intersect ranges from the given range set.

  • doesNotIntersectAnyRangeFrom(Iterable<Range<T>> ranges): Verifies that the given RangeSet does not intersect all the given ranges.

  • encloses(Range<T>…​ ranges): Verifies that the given RangeSet encloses the given ranges.

  • enclosesAll(RangeSet<T> rangeSet): Verifies that the given RangeSet encloses all ranges from the given range set.

  • enclosesAll(Iterable<Range<T>> ranges): Verifies that the given RangeSet encloses all the given ranges.

  • enclosesAnyOf(Range<T>…​ ranges): Verifies that the given RangeSet encloses at least one of the given ranges.

  • enclosesAnyRangesOf(RangeSet<T> rangeSet): Verifies that the given RangeSet encloses at least one range from the given range set.

  • enclosesAnyRangesOf(Iterable<Range<T>> ranges): Verifies that the given RangeSet encloses at least one range of the given ranges.

  • hasSize(int size): Verifies that the given RangeSet has the specific size of disconnected Range elements.

  • intersects(Range<T>…​ ranges): Verifies that the given RangeSet intersects all the given ranges.

  • intersectsAll(RangeSet<T> rangeSet): Verifies that the given RangeSet intersects all the given range set.

  • intersectsAll(Iterable<Range<T>> ranges): Verifies that the given RangeSet intersects all the given ranges.

  • intersectsAnyOf(Range<T>…​ ranges): Verifies that the given RangeSet intersects at least one of the given ranges.

  • intersectsAnyRangesOf(RangeSet<T> rangeSet): Verifies that the given RangeSet intersects at least one range of the given range set.

  • intersectsAnyRangesOf(Iterable<Range<T>> ranges): Verifies that the given RangeSet intersects at least one of the given ranges.

  • isEmpty(): Verifies that the actual RangeSet is empty.

  • isNotEmpty(): Verifies that the actual RangeSet is not empty.

  • isNullOrEmpty(): Verifies that the actual RangeSet is null or empty.

Improvements

  • Javadoc uses AssertJ site beautiful theme :)

  • Uses to assertj-core version 3.15.0.

  • Uses to guava version 29.0-jre.

  • Internal: setup GitHub actions CI build and sonar reporting.

AssertJ Guava 3.3.0

Release date: 2019-11-09

Contributors

Thanks to chrisly42 and Stefano Cordio for their contributions!

New features

Improvements

  • AssertJ’s Javadoc are now searchable.

  • Use beautiful AssertJ’s site code style for Javadoc :)

  • Migrate to JUnit 5 and assertj-core version 3.14.0.

Fixed

  • Fix for OptionalAssert.contains() that was not working for primitive arrays. (chrisly42)

Deprecated

  • Deprecate org.assertj.guava.data.MapEntry for org.assertj.core.data.MapEntry

Add InstanceOfAssertFactories to allow chain specific type assertions

Add factories for ByteSource, Multimap, Multiset, Optional (guava) and Table to allow to chain specific type assertions from a value initially declared as a less specific type.

Let’s start with the problem asInstanceOf is solving: in the following example we would like to call Table assertions but this is not possible since value is declared as an Object thus only Object assertions are accessible.

// Given a Table declared as an Object
Object actual = HashBasedTable.<Integer, Integer, String> create();

// We would like to call Table assertions but this is not possible since value is declared as an Object
assertThat(actual).isEmpty(); // this does not compile !

Thanks to asInstanceOf we can now tell AssertJ to consider value as a Table in order to call Table assertions.
To do so we need to pass an InstanceOfAssertFactory that can build a TableAssert, fortunately you don’t have to write it, it is already available in InstanceOfAssertFactories!

// Given a Table declared as an Object
Object actual = HashBasedTable.<Integer, Integer, String> create();

// With asInstanceOf, we switch to specific Table assertion by specifying the InstanceOfAssertFactory for Table
assertThat(value).asInstanceOf(InstanceOfAssertFactories.TABLE)
                 .isEmpty();

AssertJ verifies that the actual value is compatible with the assertions InstanceOfAssertFactory is going to give access to.

InstanceOfAssertFactories provides static factories for all types AssertJ provides assertions for, additional factories can be created with custom InstanceOfAssertFactory instances.