Interface WithAssumptions
-
Method Summary
Modifier and TypeMethodDescriptiondefault AbstractBooleanAssert
<?> assumeThat
(boolean actual) Creates a new instance of
assumption.BooleanAssert
default AbstractBooleanArrayAssert
<?> assumeThat
(boolean[] actual) Creates a new instance of
assumption.BooleanArrayAssert
default Boolean2DArrayAssert
assumeThat
(boolean[][] actual) Creates a new instance of
assumption.Boolean2DArrayAssert
default AbstractByteAssert
<?> assumeThat
(byte actual) Creates a new instance of
assumption.ByteAssert
default AbstractByteArrayAssert
<?> assumeThat
(byte[] actual) Creates a new instance of
assumption.ByteArrayAssert
default Byte2DArrayAssert
assumeThat
(byte[][] actual) Creates a new instance of
assumption.Byte2DArrayAssert
default AbstractCharacterAssert
<?> assumeThat
(char actual) Creates a new instance of
assumption.CharacterAssert
default AbstractCharArrayAssert
<?> assumeThat
(char[] actual) Creates a new instance of
assumption.CharArrayAssert
default Char2DArrayAssert
assumeThat
(char[][] actual) Creates a new instance of
assumption.Char2DArrayAssert
default AbstractDoubleAssert
<?> assumeThat
(double actual) Creates a new instance of
assumption.DoubleAssert
default AbstractDoubleArrayAssert
<?> assumeThat
(double[] actual) Creates a new instance of
assumption.DoubleArrayAssert
default Double2DArrayAssert
assumeThat
(double[][] actual) Creates a new instance of
assumption.Double2DArrayAssert
default AbstractFloatAssert
<?> assumeThat
(float actual) Creates a new instance of
assumption.FloatAssert
default AbstractFloatArrayAssert
<?> assumeThat
(float[] actual) Creates a new instance of
assumption.FloatArrayAssert
default Float2DArrayAssert
assumeThat
(float[][] actual) Creates a new instance of
assumption.Float2DArrayAssert
default AbstractIntegerAssert
<?> assumeThat
(int actual) Creates a new instance of
assumption.IntegerAssert
default AbstractIntArrayAssert
<?> assumeThat
(int[] actual) Creates a new instance of
assumption.IntArrayAssert
default Int2DArrayAssert
assumeThat
(int[][] actual) Creates a new instance of
assumption.Int2DArrayAssert
default AbstractLongAssert
<?> assumeThat
(long actual) Creates a new instance of
assumption.LongAssert
default AbstractLongArrayAssert
<?> assumeThat
(long[] actual) Creates a new instance of
assumption.LongArrayAssert
default Long2DArrayAssert
assumeThat
(long[][] actual) Creates a new instance of
assumption.Long2DArrayAssert
default AbstractShortAssert
<?> assumeThat
(short actual) Creates a new instance of
assumption.ShortAssert
default AbstractShortArrayAssert
<?> assumeThat
(short[] actual) Creates a new instance of
assumption.ShortArrayAssert
default Short2DArrayAssert
assumeThat
(short[][] actual) Creates a new instance of
assumption.Short2DArrayAssert
default AbstractFileAssert
<?> assumeThat
(File actual) Creates a new instance of
assumption.FileAssert
default AbstractInputStreamAssert
<?, ? extends InputStream> assumeThat
(InputStream actual) Creates a new instance of
assumption.InputStreamAssert
default AbstractBooleanAssert
<?> assumeThat
(Boolean actual) Creates a new instance of
assumption.BooleanAssert
default AbstractByteAssert
<?> assumeThat
(Byte actual) Creates a new instance of
assumption.ByteAssert
default AbstractCharacterAssert
<?> assumeThat
(Character actual) Creates a new instance of
assumption.CharacterAssert
default AbstractCharSequenceAssert
<?, ? extends CharSequence> assumeThat
(CharSequence actual) Creates a new instance of
assumption.CharSequenceAssert
default ClassAssert
assumeThat
(Class<?> actual) Creates a new instance of
assumption.ClassAssert
default AbstractDoubleAssert
<?> assumeThat
(Double actual) Creates a new instance of
assumption.DoubleAssert
default AbstractFloatAssert
<?> assumeThat
(Float actual) Creates a new instance of
assumption.FloatAssert
default AbstractIntegerAssert
<?> assumeThat
(Integer actual) Creates a new instance of
assumption.IntegerAssert
default <ELEMENT> IterableAssert
<ELEMENT> assumeThat
(Iterable<? extends ELEMENT> actual) Creates a new instance of
assumption.IterableAssert
default AbstractLongAssert
<?> assumeThat
(Long actual) Creates a new instance of
assumption.LongAssert
default AbstractShortAssert
<?> assumeThat
(Short actual) Creates a new instance of
assumption.ShortAssert
default AbstractStringAssert
<?> assumeThat
(String actual) Creates a new instance of
assumption.StringAssert
default AbstractCharSequenceAssert
<?, ? extends CharSequence> assumeThat
(StringBuffer actual) Creates a new instance of
assumption from aCharSequenceAssert
StringBuffer
.default AbstractCharSequenceAssert
<?, ? extends CharSequence> assumeThat
(StringBuilder actual) Creates a new instance of
assumption from aCharSequenceAssert
StringBuilder
.default AbstractBigDecimalAssert
<?> assumeThat
(BigDecimal actual) Creates a new instance of
assumption.BigDecimalAssert
default AbstractBigIntegerAssert
<?> assumeThat
(BigInteger actual) Creates a new instance of
assumption.BigIntegerAssert
default AbstractUriAssert
<?> assumeThat
(URI uri) Creates a new instance of
assumption.UriAssert
default AbstractUrlAssert
<?> assumeThat
(URL url) Creates a new instance of
assumption.UrlAssert
default AbstractPathAssert
<?> assumeThat
(Path actual) Creates a new instance of
assumption.PathAssert
default AbstractDurationAssert
<?> assumeThat
(Duration duration) Creates a new instance of
assumption.DurationAssert
default AbstractInstantAssert
<?> assumeThat
(Instant instant) Creates a new instance of
assumption.InstantAssert
default AbstractLocalDateAssert
<?> assumeThat
(LocalDate localDate) Creates a new instance of
assumption.LocalDateAssert
default AbstractLocalDateTimeAssert
<?> assumeThat
(LocalDateTime localDateTime) Creates a new instance of
assumption.LocalDateTimeAssert
default AbstractLocalTimeAssert
<?> assumeThat
(LocalTime localTime) Creates a new instance of
assumption.LocalTimeAssert
default AbstractOffsetDateTimeAssert
<?> assumeThat
(OffsetDateTime offsetDateTime) Creates a new instance of
assumption.OffsetDateTimeAssert
default AbstractOffsetTimeAssert
<?> assumeThat
(OffsetTime offsetTime) Creates a new instance of
assumption.OffsetTimeAssert
default AbstractPeriodAssert
<?> assumeThat
(Period period) Creates a new instance of
assumption.PeriodAssert
default AbstractZonedDateTimeAssert
<?> assumeThat
(ZonedDateTime zonedDateTime) Creates a new instance of
assumption.ZonedDateTimeAssert
default AtomicBooleanAssert
assumeThat
(AtomicBoolean actual) Creates a new instance of
assumption.AtomicBooleanAssert
default AtomicIntegerAssert
assumeThat
(AtomicInteger actual) Creates a new instance of
assumption.AtomicIntegerAssert
default AtomicIntegerArrayAssert
assumeThat
(AtomicIntegerArray actual) Creates int[] assumption forAtomicIntegerArray
.default <OBJECT> AtomicIntegerFieldUpdaterAssert
<OBJECT> assumeThat
(AtomicIntegerFieldUpdater<OBJECT> actual) Creates a new instance of
assumption.AtomicIntegerFieldUpdaterAssert
default AtomicLongAssert
assumeThat
(AtomicLong actual) Creates a new instance of
assumption.AtomicLongAssert
default AtomicLongArrayAssert
assumeThat
(AtomicLongArray actual) Creates a new instance of
assumption.AtomicLongArrayAssert
default <OBJECT> AtomicLongFieldUpdaterAssert
<OBJECT> assumeThat
(AtomicLongFieldUpdater<OBJECT> actual) Creates a new instance of
assumption.AtomicLongFieldUpdaterAssert
default <VALUE> AtomicMarkableReferenceAssert
<VALUE> assumeThat
(AtomicMarkableReference<VALUE> actual) Creates a new instance of
assumption.AtomicMarkableReferenceAssert
default <VALUE> AtomicReferenceAssert
<VALUE> assumeThat
(AtomicReference<VALUE> actual) Creates a new instance of
assumption.AtomicReferenceAssert
default <ELEMENT> AtomicReferenceArrayAssert
<ELEMENT> assumeThat
(AtomicReferenceArray<ELEMENT> actual) Creates a new instance of
assumption.AtomicReferenceArrayAssert
default <FIELD,
OBJECT>
AtomicReferenceFieldUpdaterAssert<FIELD, OBJECT> assumeThat
(AtomicReferenceFieldUpdater<OBJECT, FIELD> actual) Creates a new instance of
assumption.AtomicReferenceFieldUpdaterAssert
default <VALUE> AtomicStampedReferenceAssert
<VALUE> assumeThat
(AtomicStampedReference<VALUE> actual) Creates a new instance of
assumption.AtomicStampedReferenceAssert
default LongAdderAssert
assumeThat
(LongAdder actual) Creates a new instance of
assumption.LongAdderAssert
default <RESULT> CompletableFutureAssert
<RESULT> assumeThat
(CompletableFuture<RESULT> future) Creates a new instance ofCompletableFutureAssert
assumption.default <RESULT> CompletableFutureAssert
<RESULT> assumeThat
(CompletionStage<RESULT> actual) Creates a new instance ofCompletableFutureAssert
assumption for aCompletionStage
by converting it to aCompletableFuture
and returning aCompletableFutureAssert
.default <RESULT> AbstractFutureAssert
<?, ? extends Future<? extends RESULT>, RESULT> assumeThat
(Future<RESULT> actual) Create assertion forFutureAssert
assumption.default AbstractDateAssert
<?> assumeThat
(Date actual) Creates a new instance of
assumption.DateAssert
default DoublePredicateAssert
assumeThat
(DoublePredicate doublePredicate) Creates a new instance ofDoublePredicateAssert
assumption.default IntPredicateAssert
assumeThat
(IntPredicate intPredicate) Creates a new instance ofIntPredicateAssert
assumption.default LongPredicateAssert
assumeThat
(LongPredicate longPredicate) Creates a new instance ofLongPredicateAssert
assumption.default <T> PredicateAssert
<T> assumeThat
(Predicate<T> predicate) Creates a new instance ofPredicateAssert
assumption.default <ELEMENT> IteratorAssert
<ELEMENT> assumeThat
(Iterator<? extends ELEMENT> actual) Creates a new instance of
assumption.IteratorAssert
default <ELEMENT> FactoryBasedNavigableListAssert
<ListAssert<ELEMENT>, List<? extends ELEMENT>, ELEMENT, ObjectAssert<ELEMENT>> assumeThat
(List<? extends ELEMENT> list) Creates a new instance of
assumption.ListAssert
default <K,
V> MapAssert <K, V> assumeThat
(Map<K, V> actual) Creates a new instance of
assumption.MapAssert
default <VALUE> OptionalAssert
<VALUE> assumeThat
(Optional<VALUE> optional) Creates a new instance ofOptionalAssert
assumption.default OptionalDoubleAssert
assumeThat
(OptionalDouble optionalDouble) Creates a new instance of
assumption.OptionalDoubleAssert
default OptionalIntAssert
assumeThat
(OptionalInt optionalInt) Creates a new instance of
assumption.OptionalIntAssert
default OptionalLongAssert
assumeThat
(OptionalLong optionalLong) Creates a new instance of
assumption.OptionalLongAssert
default MatcherAssert
assumeThat
(Matcher matcher) Creates a new instance of
assumption.MatcherAssert
default <ELEMENT> AbstractSpliteratorAssert
<?, ELEMENT> assumeThat
(Spliterator<ELEMENT> spliterator) Creates a new instance of
assumption.SpliteratorAssert
default AbstractListAssert
<?, List<? extends Double>, Double, ObjectAssert<Double>> assumeThat
(DoubleStream doubleStream) Creates a new instance of
assumption from the givenListAssert
DoubleStream
.default AbstractListAssert
<?, List<? extends Integer>, Integer, ObjectAssert<Integer>> assumeThat
(IntStream intStream) Creates a new instance of
assumption from the givenListAssert
IntStream
.default AbstractListAssert
<?, List<? extends Long>, Long, ObjectAssert<Long>> assumeThat
(LongStream longStream) Creates a new instance of
assumption from the givenListAssert
LongStream
.default <ELEMENT> AbstractListAssert
<?, List<? extends ELEMENT>, ELEMENT, ObjectAssert<ELEMENT>> assumeThat
(Stream<? extends ELEMENT> stream) Creates a new instance of
assumption from the givenListAssert
Stream
.default <T> ObjectAssert
<T> assumeThat
(T actual) Creates a new instance of
assumption.ObjectAssert
default <T> ObjectArrayAssert
<T> assumeThat
(T[] actual) Creates a new instance of
assumption.ObjectArrayAssert
default <T> Object2DArrayAssert
<T> assumeThat
(T[][] actual) Creates a new instance of
assumption.Object2DArrayAssert
default AbstractThrowableAssert
<?, ? extends Throwable> assumeThatCode
(ThrowableAssert.ThrowingCallable shouldRaiseOrNotThrowable) Allows to capture and then assume on aThrowable
(easier done with lambdas).default <T> ObjectAssert
<T> assumeThatObject
(T actual) Creates a new instance of
for any object.ObjectAssert
default AbstractThrowableAssert
<?, ? extends Throwable> assumeThatThrownBy
(ThrowableAssert.ThrowingCallable shouldRaiseThrowable) Allows to capture and then assume on aThrowable
(easier done with lambdas).default void
setPreferredAssumptionException
(PreferredAssumptionException preferredAssumptionException) Sets which exception is thrown if an assumption is not met.
-
Method Details
-
assumeThat
Creates a new instance of
assumption.ObjectArrayAssert
- Type Parameters:
T
- the type of elements.- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.Object2DArrayAssert
- Type Parameters:
T
- the type of elements.- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 3.17.0
-
assumeThat
Creates a new instance of
assumption.MapAssert
- Type Parameters:
K
- the type of keys in the map.V
- the type of values in the map.- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.ShortAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.LongAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.LongAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.LongArrayAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.Long2DArrayAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 3.17.0
-
assumeThat
Creates a new instance of
assumption.ObjectAssert
- Type Parameters:
T
- the type of the actual value.- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.StringAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.DateAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.ThrowableAssert
- Type Parameters:
T
- the type of the actual value.- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.BigDecimalAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.BigIntegerAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.AtomicBooleanAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.AtomicIntegerAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
assumeThat
Creates int[] assumption forAtomicIntegerArray
.- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
default <OBJECT> AtomicIntegerFieldUpdaterAssert<OBJECT> assumeThat(AtomicIntegerFieldUpdater<OBJECT> actual) Creates a new instance of
assumption.AtomicIntegerFieldUpdaterAssert
- Type Parameters:
OBJECT
- the type of the object holding the updatable field.- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
assumeThat
Creates a new instance of
assumption.LongAdderAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
assumeThat
Creates a new instance of
assumption.AtomicLongAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
assumeThat
Creates a new instance of
assumption.AtomicLongArrayAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
assumeThat
default <OBJECT> AtomicLongFieldUpdaterAssert<OBJECT> assumeThat(AtomicLongFieldUpdater<OBJECT> actual) Creates a new instance of
assumption.AtomicLongFieldUpdaterAssert
- Type Parameters:
OBJECT
- the type of the object holding the updatable field.- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
assumeThat
Creates a new instance of
assumption.AtomicReferenceAssert
- Type Parameters:
VALUE
- the type of the value contained in theAtomicReference
.- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
assumeThat
default <ELEMENT> AtomicReferenceArrayAssert<ELEMENT> assumeThat(AtomicReferenceArray<ELEMENT> actual) Creates a new instance of
assumption.AtomicReferenceArrayAssert
- Type Parameters:
ELEMENT
- the type of the value contained in theAtomicReferenceArray
.- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
assumeThat
default <FIELD,OBJECT> AtomicReferenceFieldUpdaterAssert<FIELD,OBJECT> assumeThat(AtomicReferenceFieldUpdater<OBJECT, FIELD> actual) Creates a new instance of
assumption.AtomicReferenceFieldUpdaterAssert
- Type Parameters:
FIELD
- the type of the field which gets updated by theAtomicReferenceFieldUpdater
.OBJECT
- the type of the object holding the updatable field.- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
assumeThat
default <VALUE> AtomicMarkableReferenceAssert<VALUE> assumeThat(AtomicMarkableReference<VALUE> actual) Creates a new instance of
assumption.AtomicMarkableReferenceAssert
- Type Parameters:
VALUE
- the type of the value contained in theAtomicMarkableReference
.- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
assumeThat
default <VALUE> AtomicStampedReferenceAssert<VALUE> assumeThat(AtomicStampedReference<VALUE> actual) Creates a new instance of
assumption.AtomicStampedReferenceAssert
- Type Parameters:
VALUE
- the type of the value contained in theAtomicStampedReference
.- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
assumeThat
Creates a new instance of
assumption.CharSequenceAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption from aCharSequenceAssert
StringBuilder
.- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 3.11.0
-
assumeThat
Creates a new instance of
assumption from aCharSequenceAssert
StringBuffer
.- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 3.11.0
-
assumeThat
Creates a new instance of
assumption.ShortArrayAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.Short2DArrayAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 3.17.0
-
assumeThat
Creates a new instance of
assumption.ShortAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.ClassAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.CharacterAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.CharArrayAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.Char2DArrayAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 3.17.0
-
assumeThat
Creates a new instance of
assumption.CharacterAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.GenericComparableAssert
- Type Parameters:
T
- the type of actual.- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.IterableAssert
- Type Parameters:
ELEMENT
- the type of elements.- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.IteratorAssert
Breaking change in version 3.12.0: this method does not return anymore an
IterableAssert
but anIteratorAssert
.- Type Parameters:
ELEMENT
- the type of elements.- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.BooleanAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.BooleanArrayAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.Boolean2DArrayAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 3.17.0
-
assumeThat
Creates a new instance of
assumption.ByteAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.ByteAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.ByteArrayAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.Byte2DArrayAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 3.17.0
-
assumeThat
Creates a new instance of
assumption.BooleanAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.FloatAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.InputStreamAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.FileAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
default <RESULT> AbstractFutureAssert<?,? extends Future<? extends RESULT>, assumeThatRESULT> (Future<RESULT> actual) Create assertion forFutureAssert
assumption.- Type Parameters:
RESULT
- the type of the value contained in theFuture
.- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.PathAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.IntArrayAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.Int2DArrayAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 3.17.0
-
assumeThat
Creates a new instance of
assumption.FloatAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.Float2DArrayAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 3.17.0
-
assumeThat
Creates a new instance of
assumption.IntegerAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.FloatArrayAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.IntegerAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.DoubleAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.DoubleAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
default <ELEMENT> FactoryBasedNavigableListAssert<ListAssert<ELEMENT>,List<? extends ELEMENT>, assumeThatELEMENT, ObjectAssert<ELEMENT>> (List<? extends ELEMENT> list) Creates a new instance of
assumption.ListAssert
- Type Parameters:
ELEMENT
- the type of elements.- Parameters:
list
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
default <ELEMENT> AbstractListAssert<?,List<? extends ELEMENT>, assumeThatELEMENT, ObjectAssert<ELEMENT>> (Stream<? extends ELEMENT> stream) Creates a new instance of
assumption from the givenListAssert
Stream
.- Type Parameters:
ELEMENT
- the type of elements.- Parameters:
stream
- the Stream to test- Returns:
- the created assumption for assertion object.
- Since:
- 3.9.0
-
assumeThat
default AbstractListAssert<?,List<? extends Double>, assumeThatDouble, ObjectAssert<Double>> (DoubleStream doubleStream) Creates a new instance of
assumption from the givenListAssert
DoubleStream
.- Parameters:
doubleStream
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
default AbstractListAssert<?,List<? extends Long>, assumeThatLong, ObjectAssert<Long>> (LongStream longStream) Creates a new instance of
assumption from the givenListAssert
LongStream
.- Parameters:
longStream
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
default AbstractListAssert<?,List<? extends Integer>, assumeThatInteger, ObjectAssert<Integer>> (IntStream intStream) Creates a new instance of
assumption from the givenListAssert
IntStream
.- Parameters:
intStream
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.DoubleArrayAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.Double2DArrayAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 3.17.0
-
assumeThat
Creates a new instance of
assumption.ZonedDateTimeAssert
- Parameters:
zonedDateTime
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 3.9.0
-
assumeThat
Creates a new instance ofCompletableFutureAssert
assumption.- Type Parameters:
RESULT
- the CompletableFuture wrapped type.- Parameters:
future
- the CompletableFuture to test- Returns:
- the created assumption for assertion object.
- Since:
- 3.9.0
-
assumeThat
Creates a new instance ofCompletableFutureAssert
assumption for aCompletionStage
by converting it to aCompletableFuture
and returning aCompletableFutureAssert
.If the given
CompletionStage
is null, theCompletableFuture
in the returnedCompletableFutureAssert
will also be null.- Type Parameters:
RESULT
- the CompletableFuture wrapped type.- Parameters:
actual
- the CompletableFuture to test- Returns:
- the created assumption for assertion object.
- Since:
- 3.9.0
-
assumeThat
Creates a new instance ofOptionalAssert
assumption.- Type Parameters:
VALUE
- the Optional wrapped type.- Parameters:
optional
- the Optional to test- Returns:
- the created assumption for assertion object.
- Since:
- 3.9.0
-
assumeThat
Creates a new instance of
assumption.OptionalDoubleAssert
- Parameters:
optionalDouble
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.OptionalIntAssert
- Parameters:
optionalInt
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.OptionalLongAssert
- Parameters:
optionalLong
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.MatcherAssert
- Parameters:
matcher
- the actual Matcher.- Returns:
- the created assumption for assertion object.
-
assumeThat
Creates a new instance of
assumption.LocalDateTimeAssert
- Parameters:
localDateTime
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.LocalDateAssert
- Parameters:
localDate
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.LocalTimeAssert
- Parameters:
localTime
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.InstantAssert
- Parameters:
instant
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.DurationAssert
- Parameters:
duration
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 3.15.0
-
assumeThat
Creates a new instance of
assumption.PeriodAssert
- Parameters:
period
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 3.17.0
-
assumeThat
Creates a new instance of
assumption.OffsetTimeAssert
- Parameters:
offsetTime
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.OffsetDateTimeAssert
- Parameters:
offsetDateTime
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThatThrownBy
default AbstractThrowableAssert<?,? extends Throwable> assumeThatThrownBy(ThrowableAssert.ThrowingCallable shouldRaiseThrowable) Allows to capture and then assume on aThrowable
(easier done with lambdas).Example :
@Test public void testException() { assumeThatThrownBy(() -> { throw new Exception("boom!") }).isInstanceOf(Exception.class) .hasMessageContaining("boom"); }
- Parameters:
shouldRaiseThrowable
- TheThrowableAssert.ThrowingCallable
or lambda with the code that should raise the throwable.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThatCode
default AbstractThrowableAssert<?,? extends Throwable> assumeThatCode(ThrowableAssert.ThrowingCallable shouldRaiseOrNotThrowable) Allows to capture and then assume on aThrowable
(easier done with lambdas).Example :
ThrowingCallable callable = () -> { throw new Exception("boom!"); }; // assertion succeeds assumeThatCode(callable).isInstanceOf(Exception.class) .hasMessageContaining("boom"); // assertion fails assumeThatCode(callable).doesNotThrowAnyException();
This method was not named
assumeThat
because the java compiler reported it ambiguous when used directly with a lambda :(- Parameters:
shouldRaiseOrNotThrowable
- TheThrowableAssert.ThrowingCallable
or lambda with the code that should raise the throwable.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThatObject
Creates a new instance of
for any object.ObjectAssert
This overload is useful, when an overloaded method of assertThat(...) takes precedence over the generic
assumeThat(Object)
.Example:
Cast necessary because
assumeThat(List)
"forgets" actual type:
No cast needed, but also no additional list assertions:assumeThat(new LinkedList<>(asList("abc"))).matches(list -> ((Deque<String>) list).getFirst().equals("abc"));
assumeThatObject(new LinkedList<>(asList("abc"))).matches(list -> list.getFirst().equals("abc"));
- Type Parameters:
T
- the type of the actual value.- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
- Since:
- 3.12.0
-
assumeThat
Creates a new instance ofPredicateAssert
assumption.- Type Parameters:
T
- thePredicate
type.- Parameters:
predicate
- the Predicate to test- Returns:
- the created assumption for assertion object.
- Since:
- 3.9.0
-
assumeThat
Creates a new instance ofIntPredicateAssert
assumption.- Parameters:
intPredicate
- the IntPredicate to test- Returns:
- the created assumption for assertion object.
- Since:
- 3.9.0
-
assumeThat
Creates a new instance ofLongPredicateAssert
assumption.- Parameters:
longPredicate
- the LongPredicate to test- Returns:
- the created assumption for assertion object.
- Since:
- 3.9.0
-
assumeThat
Creates a new instance ofDoublePredicateAssert
assumption.- Parameters:
doublePredicate
- the DoublePredicate to test- Returns:
- the created assumption for assertion object.
- Since:
- 3.9.0
-
assumeThat
Creates a new instance of
assumption.UrlAssert
- Parameters:
url
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.UriAssert
- Parameters:
uri
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.SpliteratorAssert
- Type Parameters:
ELEMENT
- the type of the elements.- Parameters:
spliterator
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 3.14.0
-
setPreferredAssumptionException
default void setPreferredAssumptionException(PreferredAssumptionException preferredAssumptionException) Sets which exception is thrown if an assumption is not met.This method is useful if you are using a testing framework that supports assumptions and expect a specific exception to be thrown when an assumption is not met.
You can choose one of:
PreferredAssumptionException.TEST_NG
to throw aorg.testng.SkipException
if you are using TestNGPreferredAssumptionException.JUNIT4
to throw aorg.junit.AssumptionViolatedException
if you are using JUnit 4PreferredAssumptionException.JUNIT5
aorg.opentest4j.TestAbortedException
if you are using JUnit 5PreferredAssumptionException.AUTO_DETECT
to get the default behavior where AssertJ tries different exception (explained later on)
Make sure that the exception you choose can be found in the classpath otherwise AssertJ will throw an
IllegalStateException
.For example JUnit4 expects
org.junit.AssumptionViolatedException
, you can tell AssertJ to use it as shown below:// after this call, AssertJ will throw an org.junit.AssumptionViolatedException when an assumption is not met Assertions.setPreferredAssumptionExceptions(PreferredAssumptionException.JUNIT4);
By default, AssertJ uses the
AUTO_DETECT
mode and tries to throw one of the following exceptions, in this order:org.testng.SkipException
for TestNG (if available in the classpath)org.junit.AssumptionViolatedException
for JUnit 4 (if available in the classpath)org.opentest4j.TestAbortedException
for JUnit 5
- Parameters:
preferredAssumptionException
- the preferred exception to use withAssumptions
.- Since:
- 3.21.0
-