Top Description Methods
org.assertj.core.api

public Interface WithAssumptions

Annotations
@CheckReturnValue
Static Imports
org.assertj.core.api.Assertions.catchThrowable

A unified entry point to all assumptions from both the new Java 8 core API and the pre-Java 8 core API. As a convenience, the methods are defined in an interface so that no static imports are necessary if the test class implements this interface.

Method Summary

Modifier and TypeMethod and Description
public default <
the type of elements.
T
>
ObjectArrayAssert<T>

Returns:

the created assumption for assertion object.
assumeThat
(final T[]
the actual value.
actual
)

Creates a new instance of ObjectArrayAssert assumption.

public default <
the type of elements.
T
>
Object2DArrayAssert<T>

Returns:

the created assumption for assertion object.
assumeThat
(final T[][]
the actual value.
actual
)

Creates a new instance of Object2DArrayAssert assumption.

public default <
the type of keys in the map.
K
,
the type of values in the map.
V
>
MapAssert<K, V>

Returns:

the created assumption for assertion object.
assumeThat
(final Map<K, V>
the actual value.
actual
)

Creates a new instance of MapAssert assumption.

public default AbstractShortAssert<?>

Returns:

the created assumption for assertion object.
assumeThat
(final short
the actual value.
actual
)

Creates a new instance of ShortAssert assumption.

public default AbstractLongAssert<?>

Returns:

the created assumption for assertion object.
assumeThat
(final long
the actual value.
actual
)

Creates a new instance of LongAssert assumption.

public default AbstractLongAssert<?>

Returns:

the created assumption for assertion object.
assumeThat
(final Long
the actual value.
actual
)

Creates a new instance of LongAssert assumption.

public default AbstractLongArrayAssert<?>

Returns:

the created assumption for assertion object.
assumeThat
(final long[]
the actual value.
actual
)

Creates a new instance of LongArrayAssert assumption.

public default Long2DArrayAssert

Returns:

the created assumption for assertion object.
assumeThat
(final long[][]
the actual value.
actual
)

Creates a new instance of Long2DArrayAssert assumption.

public default <
the type of the actual value.
T
>
ObjectAssert<T>

Returns:

the created assumption for assertion object.
assumeThat
(final T
the actual value.
actual
)

Creates a new instance of ObjectAssert assumption.

public default AbstractStringAssert<?>

Returns:

the created assumption for assertion object.
assumeThat
(final String
the actual value.
actual
)

Creates a new instance of StringAssert assumption.

public default AbstractDateAssert<?>

Returns:

the created assumption for assertion object.
assumeThat
(final Date
the actual value.
actual
)

Creates a new instance of DateAssert assumption.

public default <
the type of the actual value.
T extends Throwable
>
AbstractThrowableAssert<?, T>

Returns:

the created assumption for assertion object.
assumeThat
(final T
the actual value.
actual
)

Creates a new instance of ThrowableAssert assumption.

public default AbstractBigDecimalAssert<?>

Returns:

the created assumption for assertion object.
assumeThat
(final BigDecimal
the actual value.
actual
)

Creates a new instance of BigDecimalAssert assumption.

public default AbstractBigIntegerAssert<?>

Returns:

the created assumption for assertion object.
assumeThat
(BigInteger
the actual value.
actual
)

Creates a new instance of BigIntegerAssert assumption.

public default AtomicBooleanAssert

Returns:

the created assumption for assertion object.
assumeThat
(AtomicBoolean
the actual value.
actual
)

Creates a new instance of AtomicBooleanAssert assumption.

public default AtomicIntegerAssert

Returns:

the created assertion object.
assumeThat
(AtomicInteger
the actual value.
actual
)

Creates a new instance of AtomicIntegerAssert assumption.

public default AtomicIntegerArrayAssert

Returns:

the created assumption for assertion object.
assumeThat
(AtomicIntegerArray
the actual value.
actual
)

Creates int[] assumption for AtomicIntegerArray.

public default <
the type of the object holding the updatable field.
OBJECT
>
AtomicIntegerFieldUpdaterAssert<OBJECT>

Returns:

the created assertion object.
assumeThat
(AtomicIntegerFieldUpdater<OBJECT>
the actual value.
actual
)

Creates a new instance of AtomicIntegerFieldUpdaterAssert assumption.

public default LongAdderAssert

Returns:

the created assertion object.
assumeThat
(LongAdder
the actual value.
actual
)

Creates a new instance of LongAdderAssert assumption.

public default AtomicLongAssert

Returns:

the created assertion object.
assumeThat
(AtomicLong
the actual value.
actual
)

Creates a new instance of AtomicLongAssert assumption.

public default AtomicLongArrayAssert

Returns:

the created assertion object.
assumeThat
(AtomicLongArray
the actual value.
actual
)

Creates a new instance of AtomicLongArrayAssert assumption.

public default <
the type of the object holding the updatable field.
OBJECT
>
AtomicLongFieldUpdaterAssert<OBJECT>

Returns:

the created assertion object.
assumeThat
(AtomicLongFieldUpdater<OBJECT>
the actual value.
actual
)

Creates a new instance of AtomicLongFieldUpdaterAssert assumption.

public default <
the type of the value contained in the AtomicReference.
VALUE
>
AtomicReferenceAssert<VALUE>

Returns:

the created assertion object.
assumeThat
(AtomicReference<VALUE>
the actual value.
actual
)

Creates a new instance of AtomicReferenceAssert assumption.

public default <
the type of the value contained in the AtomicReferenceArray.
ELEMENT
>
AtomicReferenceArrayAssert<ELEMENT>

Returns:

the created assertion object.
assumeThat
(AtomicReferenceArray<ELEMENT>
the actual value.
actual
)

Creates a new instance of AtomicReferenceArrayAssert assumption.

public default <
the type of the field which gets updated by the AtomicReferenceFieldUpdater.
FIELD
,
the type of the object holding the updatable field.
OBJECT
>
AtomicReferenceFieldUpdaterAssert<FIELD, OBJECT>

Returns:

the created assertion object.
assumeThat
(AtomicReferenceFieldUpdater<OBJECT, FIELD>
the actual value.
actual
)

Creates a new instance of AtomicReferenceFieldUpdaterAssert assumption.

public default <
the type of the value contained in the AtomicMarkableReference.
VALUE
>
AtomicMarkableReferenceAssert<VALUE>

Returns:

the created assertion object.
assumeThat
(AtomicMarkableReference<VALUE>
the actual value.
actual
)

Creates a new instance of AtomicMarkableReferenceAssert assumption.

public default <
the type of the value contained in the AtomicStampedReference.
VALUE
>
AtomicStampedReferenceAssert<VALUE>

Returns:

the created assertion object.
assumeThat
(AtomicStampedReference<VALUE>
the actual value.
actual
)

Creates a new instance of AtomicStampedReferenceAssert assumption.

public default AbstractCharSequenceAssert<?, ? extends CharSequence>

Returns:

the created assumption for assertion object.
assumeThat
(final CharSequence
the actual value.
actual
)

Creates a new instance of CharSequenceAssert assumption.

public default AbstractCharSequenceAssert<?, ? extends CharSequence>

Returns:

the created assumption for assertion object.
assumeThat
(final StringBuilder
the actual value.
actual
)

Creates a new instance of CharSequenceAssert assumption from a StringBuilder.

public default AbstractCharSequenceAssert<?, ? extends CharSequence>

Returns:

the created assumption for assertion object.
assumeThat
(final StringBuffer
the actual value.
actual
)

Creates a new instance of CharSequenceAssert assumption from a StringBuffer.

public default AbstractShortArrayAssert<?>

Returns:

the created assumption for assertion object.
assumeThat
(final short[]
the actual value.
actual
)

Creates a new instance of ShortArrayAssert assumption.

public default Short2DArrayAssert

Returns:

the created assumption for assertion object.
assumeThat
(final short[][]
the actual value.
actual
)

Creates a new instance of Short2DArrayAssert assumption.

public default AbstractShortAssert<?>

Returns:

the created assumption for assertion object.
assumeThat
(final Short
the actual value.
actual
)

Creates a new instance of ShortAssert assumption.

public default ClassAssert

Returns:

the created assumption for assertion object.
assumeThat
(final Class<?>
the actual value.
actual
)

Creates a new instance of ClassAssert assumption.

public default AbstractCharacterAssert<?>

Returns:

the created assumption for assertion object.
assumeThat
(final Character
the actual value.
actual
)

Creates a new instance of CharacterAssert assumption.

public default AbstractCharArrayAssert<?>

Returns:

the created assumption for assertion object.
assumeThat
(final char[]
the actual value.
actual
)

Creates a new instance of CharArrayAssert assumption.

public default Char2DArrayAssert

Returns:

the created assumption for assertion object.
assumeThat
(final char[][]
the actual value.
actual
)

Creates a new instance of Char2DArrayAssert assumption.

public default AbstractCharacterAssert<?>

Returns:

the created assumption for assertion object.
assumeThat
(final char
the actual value.
actual
)

Creates a new instance of CharacterAssert assumption.

public default <
the type of actual.
T extends Comparable<? super T>
>
AbstractComparableAssert<?, T>

Returns:

the created assumption for assertion object.
assumeThat
(final T
the actual value.
actual
)

Creates a new instance of GenericComparableAssert assumption.

public default <
the type of elements.
ELEMENT
>
IterableAssert<ELEMENT>

Returns:

the created assumption for assertion object.
assumeThat
(final Iterable<? extends ELEMENT>
the actual value.
actual
)

Creates a new instance of IterableAssert assumption.

public default <
the type of elements.
ELEMENT
>
IteratorAssert<ELEMENT>

Returns:

the created assumption for assertion object.
assumeThat
(final Iterator<? extends ELEMENT>
the actual value.
actual
)

Creates a new instance of IteratorAssert assumption.

public default AbstractBooleanAssert<?>

Returns:

the created assumption for assertion object.
assumeThat
(final Boolean
the actual value.
actual
)

Creates a new instance of BooleanAssert assumption.

public default AbstractBooleanArrayAssert<?>

Returns:

the created assumption for assertion object.
assumeThat
(final boolean[]
the actual value.
actual
)

Creates a new instance of BooleanArrayAssert assumption.

public default Boolean2DArrayAssert

Returns:

the created assumption for assertion object.
assumeThat
(final boolean[][]
the actual value.
actual
)

Creates a new instance of Boolean2DArrayAssert assumption.

public default AbstractByteAssert<?>

Returns:

the created assumption for assertion object.
assumeThat
(final byte
the actual value.
actual
)

Creates a new instance of ByteAssert assumption.

public default AbstractByteAssert<?>

Returns:

the created assumption for assertion object.
assumeThat
(final Byte
the actual value.
actual
)

Creates a new instance of ByteAssert assumption.

public default AbstractByteArrayAssert<?>

Returns:

the created assumption for assertion object.
assumeThat
(final byte[]
the actual value.
actual
)

Creates a new instance of ByteArrayAssert assumption.

public default Byte2DArrayAssert

Returns:

the created assumption for assertion object.
assumeThat
(final byte[][]
the actual value.
actual
)

Creates a new instance of Byte2DArrayAssert assumption.

public default AbstractBooleanAssert<?>

Returns:

the created assumption for assertion object.
assumeThat
(final boolean
the actual value.
actual
)

Creates a new instance of BooleanAssert assumption.

public default AbstractFloatAssert<?>

Returns:

the created assumption for assertion object.
assumeThat
(final float
the actual value.
actual
)

Creates a new instance of FloatAssert assumption.

public default AbstractInputStreamAssert<?, ? extends InputStream>

Returns:

the created assumption for assertion object.
assumeThat
(final InputStream
the actual value.
actual
)

Creates a new instance of InputStreamAssert assumption.

public default AbstractFileAssert<?>

Returns:

the created assumption for assertion object.
assumeThat
(final File
the actual value.
actual
)

Creates a new instance of FileAssert assumption.

public default <
the type of the value contained in the java.util.concurrent.Future.
RESULT
>
AbstractFutureAssert<?, ? extends Future<? extends RESULT>, RESULT>

Returns:

the created assumption for assertion object.
assumeThat
(Future<RESULT>
the actual value.
actual
)

Create assertion for FutureAssert assumption.

public default AbstractPathAssert<?>

Returns:

the created assumption for assertion object.
assumeThat
(final Path
the actual value.
actual
)

Creates a new instance of PathAssert assumption.

public default AbstractIntArrayAssert<?>

Returns:

the created assumption for assertion object.
assumeThat
(final int[]
the actual value.
actual
)

Creates a new instance of IntArrayAssert assumption.

public default Int2DArrayAssert

Returns:

the created assumption for assertion object.
assumeThat
(final int[][]
the actual value.
actual
)

Creates a new instance of Int2DArrayAssert assumption.

public default AbstractFloatAssert<?>

Returns:

the created assumption for assertion object.
assumeThat
(final Float
the actual value.
actual
)

Creates a new instance of FloatAssert assumption.

public default Float2DArrayAssert

Returns:

the created assumption for assertion object.
assumeThat
(final float[][]
the actual value.
actual
)

Creates a new instance of Float2DArrayAssert assumption.

public default AbstractIntegerAssert<?>

Returns:

the created assumption for assertion object.
assumeThat
(final int
the actual value.
actual
)

Creates a new instance of IntegerAssert assumption.

public default AbstractFloatArrayAssert<?>

Returns:

the created assumption for assertion object.
assumeThat
(final float[]
the actual value.
actual
)

Creates a new instance of FloatArrayAssert assumption.

public default AbstractIntegerAssert<?>

Returns:

the created assumption for assertion object.
assumeThat
(final Integer
the actual value.
actual
)

Creates a new instance of IntegerAssert assumption.

public default AbstractDoubleAssert<?>

Returns:

the created assumption for assertion object.
assumeThat
(final double
the actual value.
actual
)

Creates a new instance of DoubleAssert assumption.

public default AbstractDoubleAssert<?>

Returns:

the created assumption for assertion object.
assumeThat
(final Double
the actual value.
actual
)

Creates a new instance of DoubleAssert assumption.

public default <
the type of elements.
ELEMENT
>
FactoryBasedNavigableListAssert<ListAssert<ELEMENT>, List<? extends ELEMENT>, ELEMENT, ObjectAssert<ELEMENT>>

Returns:

the created assumption for assertion object.
assumeThat
(List<? extends ELEMENT>
the actual value.
list
)

Creates a new instance of ListAssert assumption.

public default <
the type of elements.
ELEMENT
>
AbstractListAssert<?, List<? extends ELEMENT>, ELEMENT, ObjectAssert<ELEMENT>>

Returns:

the created assumption for assertion object.
assumeThat
(Stream<? extends ELEMENT>
the Stream to test
stream
)

Creates a new instance of ListAssert assumption from the given Stream.

public default AbstractListAssert<?, List<? extends Double>, Double, ObjectAssert<Double>>

Returns:

the created assumption for assertion object.
assumeThat
(DoubleStream
the actual value.
doubleStream
)

Creates a new instance of ListAssert assumption from the given DoubleStream.

public default AbstractListAssert<?, List<? extends Long>, Long, ObjectAssert<Long>>

Returns:

the created assumption for assertion object.
assumeThat
(LongStream
the actual value.
longStream
)

Creates a new instance of ListAssert assumption from the given LongStream.

public default AbstractListAssert<?, List<? extends Integer>, Integer, ObjectAssert<Integer>>

Returns:

the created assumption for assertion object.
assumeThat
(IntStream
the actual value.
intStream
)

Creates a new instance of ListAssert assumption from the given IntStream.

public default AbstractDoubleArrayAssert<?>

Returns:

the created assumption for assertion object.
assumeThat
(final double[]
the actual value.
actual
)

Creates a new instance of DoubleArrayAssert assumption.

public default Double2DArrayAssert

Returns:

the created assumption for assertion object.
assumeThat
(final double[][]
the actual value.
actual
)

Creates a new instance of Double2DArrayAssert assumption.

public default AbstractZonedDateTimeAssert<?>

Returns:

the created assumption for assertion object.
assumeThat
(final ZonedDateTime
the actual value.
zonedDateTime
)

Creates a new instance of ZonedDateTimeAssert assumption.

public default <
the CompletableFuture wrapped type.
RESULT
>
CompletableFutureAssert<RESULT>

Returns:

the created assumption for assertion object.
assumeThat
(final CompletableFuture<RESULT>
the CompletableFuture to test
future
)

Creates a new instance of CompletableFutureAssert assumption.

public default <
the CompletableFuture wrapped type.
RESULT
>
CompletableFutureAssert<RESULT>

Returns:

the created assumption for assertion object.
assumeThat
(CompletionStage<RESULT>
the CompletableFuture to test
actual
)

Creates a new instance of CompletableFutureAssert assumption for a java.util.concurrent.CompletionStage by converting it to a CompletableFuture and returning a CompletableFutureAssert.

public default <
the Optional wrapped type.
VALUE
>
OptionalAssert<VALUE>

Returns:

the created assumption for assertion object.
assumeThat
(final Optional<VALUE>
the Optional to test
optional
)

Creates a new instance of OptionalAssert assumption.

public default OptionalDoubleAssert

Returns:

the created assumption for assertion object.
assumeThat
(final OptionalDouble
the actual value.
optionalDouble
)

Creates a new instance of OptionalDoubleAssert assumption.

public default OptionalIntAssert

Returns:

the created assumption for assertion object.
assumeThat
(final OptionalInt
the actual value.
optionalInt
)

Creates a new instance of OptionalIntAssert assumption.

public default OptionalLongAssert

Returns:

the created assumption for assertion object.
assumeThat
(final OptionalLong
the actual value.
optionalLong
)

Creates a new instance of OptionalLongAssert assumption.

public default MatcherAssert

Returns:

the created assumption for assertion object.
assumeThat
(final Matcher
the actual Matcher.
matcher
)

Creates a new instance of MatcherAssert assumption.

public default AbstractLocalDateTimeAssert<?>

Returns:

the created assumption for assertion object.
assumeThat
(final LocalDateTime
the actual value.
localDateTime
)

Creates a new instance of LocalDateTimeAssert assumption.

public default AbstractLocalDateAssert<?>

Returns:

the created assumption for assertion object.
assumeThat
(final LocalDate
the actual value.
localDate
)

Creates a new instance of LocalDateAssert assumption.

public default AbstractYearMonthAssert<?>

Returns:

the created assumption for assertion object.
assumeThat
(final YearMonth
the actual value.
yearMonth
)

Creates a new instance of YearMonthAssert assumption.

public default AbstractLocalTimeAssert<?>

Returns:

the created assumption for assertion object.
assumeThat
(final LocalTime
the actual value.
localTime
)

Creates a new instance of LocalTimeAssert assumption.

public default AbstractInstantAssert<?>

Returns:

the created assumption for assertion object.
assumeThat
(final Instant
the actual value.
instant
)

Creates a new instance of InstantAssert assumption.

public default AbstractDurationAssert<?>

Returns:

the created assumption for assertion object.
assumeThat
(final Duration
the actual value.
duration
)

Creates a new instance of DurationAssert assumption.

public default AbstractPeriodAssert<?>

Returns:

the created assumption for assertion object.
assumeThat
(final Period
the actual value.
period
)

Creates a new instance of PeriodAssert assumption.

public default AbstractOffsetTimeAssert<?>

Returns:

the created assumption for assertion object.
assumeThat
(final OffsetTime
the actual value.
offsetTime
)

Creates a new instance of OffsetTimeAssert assumption.

public default AbstractOffsetDateTimeAssert<?>

Returns:

the created assumption for assertion object.
assumeThat
(final OffsetDateTime
the actual value.
offsetDateTime
)

Creates a new instance of OffsetDateTimeAssert assumption.

public default <
the Predicate type.
T
>
PredicateAssert<T>

Returns:

the created assumption for assertion object.
assumeThat
(final Predicate<T>
the Predicate to test
predicate
)

Creates a new instance of PredicateAssert assumption.

public default IntPredicateAssert

Returns:

the created assumption for assertion object.
assumeThat
(final IntPredicate
the IntPredicate to test
intPredicate
)

Creates a new instance of IntPredicateAssert assumption.

public default LongPredicateAssert

Returns:

the created assumption for assertion object.
assumeThat
(final LongPredicate
the LongPredicate to test
longPredicate
)

Creates a new instance of LongPredicateAssert assumption.

public default DoublePredicateAssert

Returns:

the created assumption for assertion object.
assumeThat
(final DoublePredicate
the DoublePredicate to test
doublePredicate
)

Creates a new instance of DoublePredicateAssert assumption.

public default AbstractUrlAssert<?>

Returns:

the created assumption for assertion object.
assumeThat
(final URL
the actual value.
url
)

Creates a new instance of UrlAssert assumption.

public default AbstractUriAssert<?>

Returns:

the created assumption for assertion object.
assumeThat
(final URI
the actual value.
uri
)

Creates a new instance of UriAssert assumption.

public default <
the type of the elements.
ELEMENT
>
AbstractSpliteratorAssert<?, ELEMENT>

Returns:

the created assumption for assertion object.
assumeThat
(final Spliterator<ELEMENT>
the actual value.
spliterator
)

Creates a new instance of SpliteratorAssert assumption.

public default AbstractThrowableAssert<?, ? extends Throwable>

Returns:

the created assumption for assertion object.
assumeThatCode
(ThrowableAssert.ThrowingCallable
The ThrowingCallable or lambda with the code that should raise the throwable.
shouldRaiseOrNotThrowable
)

Allows to capture and then assume on a Throwable (easier done with lambdas).

public default <
the type of the actual value.
T
>
ObjectAssert<T>

Returns:

the created assertion object.
assumeThatObject
(T
the actual value.
actual
)

Creates a new instance of ObjectAssert for any object.

public default AbstractThrowableAssert<?, ? extends Throwable>

Returns:

the created assumption for assertion object.
assumeThatThrownBy
(final ThrowableAssert.ThrowingCallable
The ThrowingCallable or lambda with the code that should raise the throwable.
shouldRaiseThrowable
)

Allows to capture and then assume on a Throwable (easier done with lambdas).

public default void
setPreferredAssumptionException(PreferredAssumptionException
the preferred exception to use with Assumptions.
preferredAssumptionException
)

Sets which exception is thrown if an assumption is not met.