Assertions Guide

This section describes the assertions provided by AssertJ Guava.

ByteSource

Assertion Description

hasSameContentAs

Verifies that the actual ByteSource has the same content as the provided one.

hasSize

Verifies that the size of the actual ByteSource is equal to the given one.

isEmpty

Verifies that the actual ByteSource is empty.

Multimap

Assertion Description

contains

Verifies that the actual Multimap contains the given entries.

containsAllEntriesOf

Verifies that the actual Multimap contains all entries of the given one (it might contain more entries).

containsKeys

Verifies that the actual Multimap contains the given keys.

containsValues

Verifies that the actual Multimap contains the given values for any key.

hasSameEntriesAs

Verifies that the actual Multimap has the same entries as the given one.

hasSize

Verifies that the number of values in the actual Multimap is equal to the given one.

isEmpty

Verifies that the actual Multimap is empty.

isNotEmpty

Verifies that the actual Multimap is not empty.

Multiset

In addition to Iterable assertions, the following are also available.

Assertion Description

contains

Verifies the actual Multiset contains the given value exactly the given number of times.

containsAtLeast

Verifies the actual Multiset contains the given value at least the given number of times.

containsAtMost

Verifies the actual Multiset contains the given value at most the given number of times.

Optional

Assertion Description

contains

Verifies that the actual Optional contains the given value.

extractingCharSequence

Chain assertion on the content of the Optional.

extractingValue

Chain assertion on the content of the Optional.

isAbsent

Verifies that the actual Optional contained instance is absent/null.

isPresent

Verifies that the actual Optional contains a (non-null) instance.

Range

Assertion Description

contains

Verifies that the actual Range contains the given values.

doesNotContain

Verifies that the actual Range does not contain the given values.

hasClosedLowerBound

Verifies that the actual Range lower bound is closed.

hasClosedUpperBound

Verifies that the actual Range upper bound is closed.

hasLowerEndpointEqualTo

Verifies that the actual Range lower endpoint is equal to the given value.

hasOpenedLowerBound

Verifies that the actual Range lower bound is opened.

hasOpenedUpperBound

Verifies that the actual Range upper bound is opened.

hasUpperEndpointEqualTo

Verifies that the actual Range upper endpoint is equal to the given value.

isEmpty

Verifies that the actual Range is empty.

isNotEmpty

Verifies that the actual Range is not empty.

RangeMap

Assertion Description

contains

Verifies that the actual RangeMap contains the given entries.

containsKeys

Verifies that the actual RangeMap contains the given keys.

containsValues

Verifies that the actual RangeMap contains the given values.

isEmpty

Verifies that the actual RangeMap is empty.

isNotEmpty

Verifies that the actual RangeMap is not empty.

RangeSet

Assertion Description

contains

Verifies that the given RangeSet contains the given ranges.

containsAll

Verifies that the given RangeSet contains all the given ranges.

containsAnyOf

Verifies that the given RangeSet contains at least one of the given ranges.

containsAnyRangesOf

Verifies that the given RangeSet contains at least one of the given ranges.

doesNotContain

Verifies that the given RangeSet does not contain any of the given ranges.

doesNotContainAll

Verifies that the given RangeSet does not contain any of the given ranges.

doesNotEnclose

Verifies that the given RangeSet does not enclose the given ranges.

doesNotEncloseAnyRangesOf

Verifies that the given RangeSet does not enclose any range from the given range set.

doesNotEncloseAnyRangesOf

Verifies that the given RangeSet does not enclose any of the given ranges.

doesNotIntersect

Verifies that the given RangeSet does not intersect the given ranges.

doesNotIntersectAnyRangeFrom

Verifies that the given RangeSet does not intersect ranges from the given range set.

doesNotIntersectAnyRangeFrom

Verifies that the given RangeSet does not intersect all the given ranges.

encloses

Verifies that the given RangeSet encloses the given ranges.

enclosesAll

Verifies that the given RangeSet encloses all ranges from the given range set.

enclosesAll

Verifies that the given RangeSet encloses all the given ranges.

enclosesAnyOf

Verifies that the given RangeSet encloses at least one of the given ranges.

enclosesAnyRangesOf

Verifies that the given RangeSet encloses at least one range from the given range set.

enclosesAnyRangesOf

Verifies that the given RangeSet encloses at least one range of the given ranges.

hasSize

Verifies that the given RangeSet has specific size of disconnected Range elements.

intersects

Verifies that the given RangeSet intersects all the given ranges.

intersectsAll

Verifies that the given RangeSet intersects all the given range set.

intersectsAll

Verifies that the given RangeSet intersects all the given ranges.

intersectsAnyOf

Verifies that the given RangeSet intersects at least one of the given ranges.

intersectsAnyRangesOf

Verifies that the given RangeSet intersects at least one range of the given range set.

intersectsAnyRangesOf

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.

Table

Assertion Description

containsCell

Verifies that the actual Table contains the mapping of row/column to value.

containsColumns

Verifies that the actual Table contains the given columns.

containsRows

Verifies that the actual Table contains the given rows.

containsValues

Verifies that the actual Table contains the given values for any key.

hasColumnCount

Verifies that the actual Table has the expected number of columns.

hasRowCount

Verifies that the actual Table has the expected number of rows.

hasSize

Verifies that the actual Table has the expected number of cells.

isEmpty

Verifies that the actual Table is empty.