Interface WithAssumptions
-
Method Summary
Modifier and TypeMethodDescriptiondefault AbstractBooleanAssert<?> assumeThat(boolean actual) Creates a new instance ofassumption.BooleanAssertdefault AbstractBooleanArrayAssert<?> assumeThat(boolean[] actual) Creates a new instance ofassumption.BooleanArrayAssertdefault Boolean2DArrayAssertassumeThat(boolean[][] actual) Creates a new instance ofassumption.Boolean2DArrayAssertdefault AbstractByteAssert<?> assumeThat(byte actual) Creates a new instance ofassumption.ByteAssertdefault AbstractByteArrayAssert<?> assumeThat(byte[] actual) Creates a new instance ofassumption.ByteArrayAssertdefault Byte2DArrayAssertassumeThat(byte[][] actual) Creates a new instance ofassumption.Byte2DArrayAssertdefault AbstractCharacterAssert<?> assumeThat(char actual) Creates a new instance ofassumption.CharacterAssertdefault AbstractCharArrayAssert<?> assumeThat(char[] actual) Creates a new instance ofassumption.CharArrayAssertdefault Char2DArrayAssertassumeThat(char[][] actual) Creates a new instance ofassumption.Char2DArrayAssertdefault AbstractDoubleAssert<?> assumeThat(double actual) Creates a new instance ofassumption.DoubleAssertdefault AbstractDoubleArrayAssert<?> assumeThat(double[] actual) Creates a new instance ofassumption.DoubleArrayAssertdefault Double2DArrayAssertassumeThat(double[][] actual) Creates a new instance ofassumption.Double2DArrayAssertdefault AbstractFloatAssert<?> assumeThat(float actual) Creates a new instance ofassumption.FloatAssertdefault AbstractFloatArrayAssert<?> assumeThat(float[] actual) Creates a new instance ofassumption.FloatArrayAssertdefault Float2DArrayAssertassumeThat(float[][] actual) Creates a new instance ofassumption.Float2DArrayAssertdefault AbstractIntegerAssert<?> assumeThat(int actual) Creates a new instance ofassumption.IntegerAssertdefault AbstractIntArrayAssert<?> assumeThat(int[] actual) Creates a new instance ofassumption.IntArrayAssertdefault Int2DArrayAssertassumeThat(int[][] actual) Creates a new instance ofassumption.Int2DArrayAssertdefault AbstractLongAssert<?> assumeThat(long actual) Creates a new instance ofassumption.LongAssertdefault AbstractLongArrayAssert<?> assumeThat(long[] actual) Creates a new instance ofassumption.LongArrayAssertdefault Long2DArrayAssertassumeThat(long[][] actual) Creates a new instance ofassumption.Long2DArrayAssertdefault AbstractShortAssert<?> assumeThat(short actual) Creates a new instance ofassumption.ShortAssertdefault AbstractShortArrayAssert<?> assumeThat(short[] actual) Creates a new instance ofassumption.ShortArrayAssertdefault Short2DArrayAssertassumeThat(short[][] actual) Creates a new instance ofassumption.Short2DArrayAssertdefault AbstractFileAssert<?> assumeThat(File actual) Creates a new instance ofassumption.FileAssertdefault AbstractInputStreamAssert<?, ? extends InputStream> assumeThat(InputStream actual) Creates a new instance ofassumption.InputStreamAssertdefault AbstractBooleanAssert<?> assumeThat(Boolean actual) Creates a new instance ofassumption.BooleanAssertdefault AbstractByteAssert<?> assumeThat(Byte actual) Creates a new instance ofassumption.ByteAssertdefault AbstractCharacterAssert<?> assumeThat(Character actual) Creates a new instance ofassumption.CharacterAssertdefault AbstractCharSequenceAssert<?, ? extends CharSequence> assumeThat(CharSequence actual) Creates a new instance ofassumption.CharSequenceAssertdefault ClassAssertassumeThat(Class<?> actual) Creates a new instance ofassumption.ClassAssertdefault AbstractDoubleAssert<?> assumeThat(Double actual) Creates a new instance ofassumption.DoubleAssertdefault AbstractFloatAssert<?> assumeThat(Float actual) Creates a new instance ofassumption.FloatAssertdefault AbstractIntegerAssert<?> assumeThat(Integer actual) Creates a new instance ofassumption.IntegerAssertdefault <ELEMENT> IterableAssert<ELEMENT> assumeThat(Iterable<? extends ELEMENT> actual) Creates a new instance ofassumption.IterableAssertdefault AbstractLongAssert<?> assumeThat(Long actual) Creates a new instance ofassumption.LongAssertdefault AbstractShortAssert<?> assumeThat(Short actual) Creates a new instance ofassumption.ShortAssertdefault AbstractStringAssert<?> assumeThat(String actual) Creates a new instance ofassumption.StringAssertdefault AbstractCharSequenceAssert<?, ? extends CharSequence> assumeThat(StringBuffer actual) Creates a new instance ofassumption from aCharSequenceAssertStringBuffer.default AbstractCharSequenceAssert<?, ? extends CharSequence> assumeThat(StringBuilder actual) Creates a new instance ofassumption from aCharSequenceAssertStringBuilder.default AbstractBigDecimalAssert<?> assumeThat(BigDecimal actual) Creates a new instance ofassumption.BigDecimalAssertdefault AbstractBigIntegerAssert<?> assumeThat(BigInteger actual) Creates a new instance ofassumption.BigIntegerAssertdefault AbstractUriAssert<?> assumeThat(URI uri) Creates a new instance ofassumption.UriAssertdefault AbstractUrlAssert<?> assumeThat(URL url) Creates a new instance ofassumption.UrlAssertdefault AbstractPathAssert<?> assumeThat(Path actual) Creates a new instance ofassumption.PathAssertdefault AbstractDurationAssert<?> assumeThat(Duration duration) Creates a new instance ofassumption.DurationAssertdefault AbstractInstantAssert<?> assumeThat(Instant instant) Creates a new instance ofassumption.InstantAssertdefault AbstractLocalDateAssert<?> assumeThat(LocalDate localDate) Creates a new instance ofassumption.LocalDateAssertdefault AbstractLocalDateTimeAssert<?> assumeThat(LocalDateTime localDateTime) Creates a new instance ofassumption.LocalDateTimeAssertdefault AbstractLocalTimeAssert<?> assumeThat(LocalTime localTime) Creates a new instance ofassumption.LocalTimeAssertdefault AbstractOffsetDateTimeAssert<?> assumeThat(OffsetDateTime offsetDateTime) Creates a new instance ofassumption.OffsetDateTimeAssertdefault AbstractOffsetTimeAssert<?> assumeThat(OffsetTime offsetTime) Creates a new instance ofassumption.OffsetTimeAssertdefault AbstractPeriodAssert<?> assumeThat(Period period) Creates a new instance ofassumption.PeriodAssertdefault AbstractYearMonthAssert<?> assumeThat(YearMonth yearMonth) Creates a new instance ofassumption.YearMonthAssertdefault AbstractZonedDateTimeAssert<?> assumeThat(ZonedDateTime zonedDateTime) Creates a new instance ofassumption.ZonedDateTimeAssertdefault AtomicBooleanAssertassumeThat(AtomicBoolean actual) Creates a new instance ofassumption.AtomicBooleanAssertdefault AtomicIntegerAssertassumeThat(AtomicInteger actual) Creates a new instance ofassumption.AtomicIntegerAssertdefault AtomicIntegerArrayAssertassumeThat(AtomicIntegerArray actual) Creates int[] assumption forAtomicIntegerArray.default <OBJECT> AtomicIntegerFieldUpdaterAssert<OBJECT> assumeThat(AtomicIntegerFieldUpdater<OBJECT> actual) Creates a new instance ofassumption.AtomicIntegerFieldUpdaterAssertdefault AtomicLongAssertassumeThat(AtomicLong actual) Creates a new instance ofassumption.AtomicLongAssertdefault AtomicLongArrayAssertassumeThat(AtomicLongArray actual) Creates a new instance ofassumption.AtomicLongArrayAssertdefault <OBJECT> AtomicLongFieldUpdaterAssert<OBJECT> assumeThat(AtomicLongFieldUpdater<OBJECT> actual) Creates a new instance ofassumption.AtomicLongFieldUpdaterAssertdefault <VALUE> AtomicMarkableReferenceAssert<VALUE> assumeThat(AtomicMarkableReference<VALUE> actual) Creates a new instance ofassumption.AtomicMarkableReferenceAssertdefault <VALUE> AtomicReferenceAssert<VALUE> assumeThat(AtomicReference<VALUE> actual) Creates a new instance ofassumption.AtomicReferenceAssertdefault <ELEMENT> AtomicReferenceArrayAssert<ELEMENT> assumeThat(AtomicReferenceArray<ELEMENT> actual) Creates a new instance ofassumption.AtomicReferenceArrayAssertdefault <FIELD,OBJECT>
AtomicReferenceFieldUpdaterAssert<FIELD, OBJECT> assumeThat(AtomicReferenceFieldUpdater<OBJECT, FIELD> actual) Creates a new instance ofassumption.AtomicReferenceFieldUpdaterAssertdefault <VALUE> AtomicStampedReferenceAssert<VALUE> assumeThat(AtomicStampedReference<VALUE> actual) Creates a new instance ofassumption.AtomicStampedReferenceAssertdefault LongAdderAssertassumeThat(LongAdder actual) Creates a new instance ofassumption.LongAdderAssertdefault <RESULT> CompletableFutureAssert<RESULT> assumeThat(CompletableFuture<RESULT> future) Creates a new instance ofCompletableFutureAssertassumption.default <RESULT> CompletableFutureAssert<RESULT> assumeThat(CompletionStage<RESULT> actual) Creates a new instance ofCompletableFutureAssertassumption for aCompletionStageby converting it to aCompletableFutureand returning aCompletableFutureAssert.default <RESULT> AbstractFutureAssert<?, ? extends Future<? extends RESULT>, RESULT> assumeThat(Future<RESULT> actual) Create assertion forFutureAssertassumption.default AbstractDateAssert<?> assumeThat(Date actual) Creates a new instance ofassumption.DateAssertdefault DoublePredicateAssertassumeThat(DoublePredicate doublePredicate) Creates a new instance ofDoublePredicateAssertassumption.default IntPredicateAssertassumeThat(IntPredicate intPredicate) Creates a new instance ofIntPredicateAssertassumption.default LongPredicateAssertassumeThat(LongPredicate longPredicate) Creates a new instance ofLongPredicateAssertassumption.default <T> PredicateAssert<T> assumeThat(Predicate<T> predicate) Creates a new instance ofPredicateAssertassumption.default <ELEMENT> IteratorAssert<ELEMENT> assumeThat(Iterator<? extends ELEMENT> actual) Creates a new instance ofassumption.IteratorAssertdefault <ELEMENT> FactoryBasedNavigableListAssert<ListAssert<ELEMENT>, List<? extends ELEMENT>, ELEMENT, ObjectAssert<ELEMENT>> assumeThat(List<? extends ELEMENT> list) Creates a new instance ofassumption.ListAssertdefault <K,V> MapAssert <K, V> assumeThat(Map<K, V> actual) Creates a new instance ofassumption.MapAssertdefault <VALUE> OptionalAssert<VALUE> assumeThat(Optional<VALUE> optional) Creates a new instance ofOptionalAssertassumption.default OptionalDoubleAssertassumeThat(OptionalDouble optionalDouble) Creates a new instance ofassumption.OptionalDoubleAssertdefault OptionalIntAssertassumeThat(OptionalInt optionalInt) Creates a new instance ofassumption.OptionalIntAssertdefault OptionalLongAssertassumeThat(OptionalLong optionalLong) Creates a new instance ofassumption.OptionalLongAssertdefault MatcherAssertassumeThat(Matcher matcher) Creates a new instance ofassumption.MatcherAssertdefault <ELEMENT> AbstractSpliteratorAssert<?, ELEMENT> assumeThat(Spliterator<ELEMENT> spliterator) Creates a new instance ofassumption.SpliteratorAssertdefault AbstractListAssert<?, List<? extends Double>, Double, ObjectAssert<Double>> assumeThat(DoubleStream doubleStream) Creates a new instance ofassumption from the givenListAssertDoubleStream.default AbstractListAssert<?, List<? extends Integer>, Integer, ObjectAssert<Integer>> assumeThat(IntStream intStream) Creates a new instance ofassumption from the givenListAssertIntStream.default AbstractListAssert<?, List<? extends Long>, Long, ObjectAssert<Long>> assumeThat(LongStream longStream) Creates a new instance ofassumption from the givenListAssertLongStream.default <ELEMENT> AbstractListAssert<?, List<? extends ELEMENT>, ELEMENT, ObjectAssert<ELEMENT>> assumeThat(Stream<? extends ELEMENT> stream) Creates a new instance ofassumption from the givenListAssertStream.default <T> ObjectAssert<T> assumeThat(T actual) Creates a new instance ofassumption.ObjectAssertdefault <T> ObjectArrayAssert<T> assumeThat(T[] actual) Creates a new instance ofassumption.ObjectArrayAssertdefault <T> Object2DArrayAssert<T> assumeThat(T[][] actual) Creates a new instance ofassumption.Object2DArrayAssertdefault 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 offor any object.ObjectAssertdefault AbstractThrowableAssert<?, ? extends Throwable> assumeThatThrownBy(ThrowableAssert.ThrowingCallable shouldRaiseThrowable) Allows to capture and then assume on aThrowable(easier done with lambdas).default voidsetPreferredAssumptionException(PreferredAssumptionException preferredAssumptionException) Sets which exception is thrown if an assumption is not met.
-
Method Details
-
assumeThat
Creates a new instance ofassumption.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 ofassumption.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 ofassumption.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 ofassumption.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 ofassumption.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 ofassumption.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 ofassumption.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 ofassumption.Long2DArrayAssert- Parameters:
actual- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 3.17.0
-
assumeThat
Creates a new instance ofassumption.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 ofassumption.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 ofassumption.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 ofassumption.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 ofassumption.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 ofassumption.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 ofassumption.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 ofassumption.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 ofassumption.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 ofassumption.LongAdderAssert- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
-
assumeThat
Creates a new instance ofassumption.AtomicLongAssert- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
-
assumeThat
Creates a new instance ofassumption.AtomicLongArrayAssert- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
-
assumeThat
default <OBJECT> AtomicLongFieldUpdaterAssert<OBJECT> assumeThat(AtomicLongFieldUpdater<OBJECT> actual) Creates a new instance ofassumption.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 ofassumption.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 ofassumption.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 ofassumption.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 ofassumption.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 ofassumption.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 ofassumption.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 ofassumption from aCharSequenceAssertStringBuilder.- Parameters:
actual- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 3.11.0
-
assumeThat
Creates a new instance ofassumption from aCharSequenceAssertStringBuffer.- Parameters:
actual- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 3.11.0
-
assumeThat
Creates a new instance ofassumption.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 ofassumption.Short2DArrayAssert- Parameters:
actual- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 3.17.0
-
assumeThat
Creates a new instance ofassumption.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 ofassumption.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 ofassumption.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 ofassumption.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 ofassumption.Char2DArrayAssert- Parameters:
actual- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 3.17.0
-
assumeThat
Creates a new instance ofassumption.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 ofassumption.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 ofassumption.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 ofassumption.IteratorAssertBreaking change in version 3.12.0: this method does not return anymore an
IterableAssertbut 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 ofassumption.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 ofassumption.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 ofassumption.Boolean2DArrayAssert- Parameters:
actual- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 3.17.0
-
assumeThat
Creates a new instance ofassumption.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 ofassumption.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 ofassumption.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 ofassumption.Byte2DArrayAssert- Parameters:
actual- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 3.17.0
-
assumeThat
Creates a new instance ofassumption.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 ofassumption.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 ofassumption.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 ofassumption.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 forFutureAssertassumption.- 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 ofassumption.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 ofassumption.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 ofassumption.Int2DArrayAssert- Parameters:
actual- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 3.17.0
-
assumeThat
Creates a new instance ofassumption.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 ofassumption.Float2DArrayAssert- Parameters:
actual- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 3.17.0
-
assumeThat
Creates a new instance ofassumption.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 ofassumption.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 ofassumption.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 ofassumption.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 ofassumption.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 ofassumption.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 ofassumption from the givenListAssertStream.- 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 ofassumption from the givenListAssertDoubleStream.- 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 ofassumption from the givenListAssertLongStream.- 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 ofassumption from the givenListAssertIntStream.- Parameters:
intStream- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance ofassumption.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 ofassumption.Double2DArrayAssert- Parameters:
actual- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 3.17.0
-
assumeThat
Creates a new instance ofassumption.ZonedDateTimeAssert- Parameters:
zonedDateTime- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 3.9.0
-
assumeThat
Creates a new instance ofCompletableFutureAssertassumption.- 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 ofCompletableFutureAssertassumption for aCompletionStageby converting it to aCompletableFutureand returning aCompletableFutureAssert.If the given
CompletionStageis null, theCompletableFuturein the returnedCompletableFutureAssertwill 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 ofOptionalAssertassumption.- 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 ofassumption.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 ofassumption.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 ofassumption.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 ofassumption.MatcherAssert- Parameters:
matcher- the actual Matcher.- Returns:
- the created assumption for assertion object.
-
assumeThat
Creates a new instance ofassumption.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 ofassumption.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 ofassumption.YearMonthAssert- Parameters:
yearMonth- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 3.26.0
-
assumeThat
Creates a new instance ofassumption.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 ofassumption.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 ofassumption.DurationAssert- Parameters:
duration- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 3.15.0
-
assumeThat
Creates a new instance ofassumption.PeriodAssert- Parameters:
period- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 3.17.0
-
assumeThat
Creates a new instance ofassumption.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 ofassumption.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.ThrowingCallableor 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
assumeThatbecause the java compiler reported it ambiguous when used directly with a lambda :(- Parameters:
shouldRaiseOrNotThrowable- TheThrowableAssert.ThrowingCallableor 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 offor any object.ObjectAssertThis 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 ofPredicateAssertassumption.- Type Parameters:
T- thePredicatetype.- Parameters:
predicate- the Predicate to test- Returns:
- the created assumption for assertion object.
- Since:
- 3.9.0
-
assumeThat
Creates a new instance ofIntPredicateAssertassumption.- Parameters:
intPredicate- the IntPredicate to test- Returns:
- the created assumption for assertion object.
- Since:
- 3.9.0
-
assumeThat
Creates a new instance ofLongPredicateAssertassumption.- Parameters:
longPredicate- the LongPredicate to test- Returns:
- the created assumption for assertion object.
- Since:
- 3.9.0
-
assumeThat
Creates a new instance ofDoublePredicateAssertassumption.- Parameters:
doublePredicate- the DoublePredicate to test- Returns:
- the created assumption for assertion object.
- Since:
- 3.9.0
-
assumeThat
Creates a new instance ofassumption.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 ofassumption.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 ofassumption.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_NGto throw aorg.testng.SkipExceptionif you are using TestNGPreferredAssumptionException.JUNIT4to throw aorg.junit.AssumptionViolatedExceptionif you are using JUnit 4PreferredAssumptionException.JUNIT5aorg.opentest4j.TestAbortedExceptionif you are using JUnit 5PreferredAssumptionException.AUTO_DETECTto 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_DETECTmode and tries to throw one of the following exceptions, in this order:org.testng.SkipExceptionfor TestNG (if available in the classpath)org.junit.AssumptionViolatedExceptionfor JUnit 4 (if available in the classpath)org.opentest4j.TestAbortedExceptionfor JUnit 5
- Parameters:
preferredAssumptionException- the preferred exception to use withAssumptions.- Since:
- 3.21.0
-