Class Assumptions
- Direct Known Subclasses:
BDDAssumptions
- Since:
- 2.9.0 / 3.9.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic AbstractBooleanAssert<?> assumeThat(boolean actual) Creates a new instance ofassumption.BooleanAssertstatic AbstractBooleanArrayAssert<?> assumeThat(boolean[] actual) Creates a new instance ofassumption.BooleanArrayAssertstatic Boolean2DArrayAssertassumeThat(boolean[][] actual) Creates a new instance ofassumption.Boolean2DArrayAssertstatic AbstractByteAssert<?> assumeThat(byte actual) Creates a new instance ofassumption.ByteAssertstatic AbstractByteArrayAssert<?> assumeThat(byte[] actual) Creates a new instance ofassumption.ByteArrayAssertstatic Byte2DArrayAssertassumeThat(byte[][] actual) Creates a new instance ofassumption.Byte2DArrayAssertstatic AbstractCharacterAssert<?> assumeThat(char actual) Creates a new instance ofassumption.CharacterAssertstatic AbstractCharArrayAssert<?> assumeThat(char[] actual) Creates a new instance ofassumption.CharArrayAssertstatic Char2DArrayAssertassumeThat(char[][] actual) Creates a new instance ofassumption.Char2DArrayAssertstatic AbstractDoubleAssert<?> assumeThat(double actual) Creates a new instance ofassumption.DoubleAssertstatic AbstractDoubleArrayAssert<?> assumeThat(double[] actual) Creates a new instance ofassumption.DoubleArrayAssertstatic Double2DArrayAssertassumeThat(double[][] actual) Creates a new instance ofassumption.Double2DArrayAssertstatic AbstractFloatAssert<?> assumeThat(float actual) Creates a new instance ofassumption.FloatAssertstatic AbstractFloatArrayAssert<?> assumeThat(float[] actual) Creates a new instance ofassumption.FloatArrayAssertstatic Float2DArrayAssertassumeThat(float[][] actual) Creates a new instance ofassumption.Float2DArrayAssertstatic AbstractIntegerAssert<?> assumeThat(int actual) Creates a new instance ofassumption.IntegerAssertstatic AbstractIntArrayAssert<?> assumeThat(int[] actual) Creates a new instance ofassumption.IntArrayAssertstatic Int2DArrayAssertassumeThat(int[][] actual) Creates a new instance ofassumption.Int2DArrayAssertstatic AbstractLongAssert<?> assumeThat(long actual) Creates a new instance ofassumption.LongAssertstatic AbstractLongArrayAssert<?> assumeThat(long[] actual) Creates a new instance ofassumption.LongArrayAssertstatic Long2DArrayAssertassumeThat(long[][] actual) Creates a new instance ofassumption.Long2DArrayAssertstatic AbstractShortAssert<?> assumeThat(short actual) Creates a new instance ofassumption.ShortAssertstatic AbstractShortArrayAssert<?> assumeThat(short[] actual) Creates a new instance ofassumption.ShortArrayAssertstatic Short2DArrayAssertassumeThat(short[][] actual) Creates a new instance ofassumption.Short2DArrayAssertstatic AbstractFileAssert<?> assumeThat(File actual) Creates a new instance ofassumption.FileAssertstatic AbstractInputStreamAssert<?, ? extends InputStream> assumeThat(InputStream actual) Creates a new instance ofassumption.InputStreamAssertstatic AbstractBooleanAssert<?> assumeThat(Boolean actual) Creates a new instance ofassumption.BooleanAssertstatic AbstractByteAssert<?> assumeThat(Byte actual) Creates a new instance ofassumption.ByteAssertstatic AbstractCharacterAssert<?> assumeThat(Character actual) Creates a new instance ofassumption.CharacterAssertstatic AbstractCharSequenceAssert<?, ? extends CharSequence> assumeThat(CharSequence actual) Creates a new instance ofassumption.CharSequenceAssertstatic ClassAssertassumeThat(Class<?> actual) Creates a new instance ofassumption.ClassAssertstatic AbstractDoubleAssert<?> assumeThat(Double actual) Creates a new instance ofassumption.DoubleAssertstatic AbstractFloatAssert<?> assumeThat(Float actual) Creates a new instance ofassumption.FloatAssertstatic AbstractIntegerAssert<?> assumeThat(Integer actual) Creates a new instance ofassumption.IntegerAssertstatic <ELEMENT> IterableAssert<ELEMENT> assumeThat(Iterable<? extends ELEMENT> actual) Creates a new instance ofassumption.IterableAssertstatic AbstractLongAssert<?> assumeThat(Long actual) Creates a new instance ofassumption.LongAssertstatic AbstractShortAssert<?> assumeThat(Short actual) Creates a new instance ofassumption.ShortAssertstatic AbstractStringAssert<?> assumeThat(String actual) Creates a new instance ofassumption.StringAssertstatic AbstractCharSequenceAssert<?, ? extends CharSequence> assumeThat(StringBuffer actual) Creates a new instance ofassumption from aCharSequenceAssertStringBuffer.static AbstractCharSequenceAssert<?, ? extends CharSequence> assumeThat(StringBuilder actual) Creates a new instance ofassumption from aCharSequenceAssertStringBuilder.static AbstractBigDecimalAssert<?> assumeThat(BigDecimal actual) Creates a new instance ofassumption.BigDecimalAssertstatic AbstractBigIntegerAssert<?> assumeThat(BigInteger actual) Creates a new instance ofassumption.BigIntegerAssertstatic AbstractUriAssert<?> assumeThat(URI actual) Creates a new instance ofassumption.UriAssertstatic AbstractUrlAssert<?> assumeThat(URL actual) Creates a new instance ofassumption.UrlAssertstatic AbstractPathAssert<?> assumeThat(Path actual) Creates a new instance ofPathAssertassumption.static AbstractDurationAssert<?> assumeThat(Duration actual) Creates a new instance ofDurationAssertassumption.static AbstractInstantAssert<?> assumeThat(Instant actual) Creates a new instance ofInstantAssertassumption.static AbstractLocalDateAssert<?> assumeThat(LocalDate actual) Creates a new instance ofLocalDateAssertassumption.static AbstractLocalDateTimeAssert<?> assumeThat(LocalDateTime actual) Creates a new instance ofLocalDateTimeAssertassumption.static AbstractLocalTimeAssert<?> assumeThat(LocalTime actual) Creates a new instance ofLocalTimeAssertassumption.static AbstractOffsetDateTimeAssert<?> assumeThat(OffsetDateTime actual) Creates a new instance ofOffsetDateTimeAssertassumption.static AbstractOffsetTimeAssert<?> assumeThat(OffsetTime actual) Creates a new instance ofOffsetTimeAssertassumption.static AbstractPeriodAssert<?> assumeThat(Period actual) Creates a new instance ofPeriodAssertassumption.static AbstractYearMonthAssert<?> assumeThat(YearMonth actual) Creates a new instance ofYearMonthAssertassumption.static AbstractZonedDateTimeAssert<?> assumeThat(ZonedDateTime actual) Creates a new instance ofZonedDateTimeAssertassumption.static <E> AbstractCollectionAssert<?, Collection<? extends E>, E, ObjectAssert<E>> assumeThat(Collection<? extends E> actual) Creates a new instance ofassumption.CollectionAssertstatic AtomicBooleanAssertassumeThat(AtomicBoolean actual) Create assumption forAtomicBoolean.static AtomicIntegerAssertassumeThat(AtomicInteger actual) Create assumption forAtomicInteger.static AtomicIntegerArrayAssertassumeThat(AtomicIntegerArray actual) Creates int[] assumption forAtomicIntegerArray.static <OBJECT> AtomicIntegerFieldUpdaterAssert<OBJECT> assumeThat(AtomicIntegerFieldUpdater<OBJECT> actual) Create assumption forAtomicIntegerFieldUpdater.static AtomicLongAssertassumeThat(AtomicLong actual) Create assumption forAtomicLong.static AtomicLongArrayAssertassumeThat(AtomicLongArray actual) Create assumption forAtomicLongArray.static <OBJECT> AtomicLongFieldUpdaterAssert<OBJECT> assumeThat(AtomicLongFieldUpdater<OBJECT> actual) Create assumption forAtomicLongFieldUpdater.static <VALUE> AtomicMarkableReferenceAssert<VALUE> assumeThat(AtomicMarkableReference<VALUE> actual) Create assumption forAtomicMarkableReference.static <VALUE> AtomicReferenceAssert<VALUE> assumeThat(AtomicReference<VALUE> actual) Create assumption forAtomicReference.static <ELEMENT> AtomicReferenceArrayAssert<ELEMENT> assumeThat(AtomicReferenceArray<ELEMENT> actual) Create assumption forAtomicReferenceArray.static <FIELD,OBJECT>
AtomicReferenceFieldUpdaterAssert<FIELD, OBJECT> assumeThat(AtomicReferenceFieldUpdater<OBJECT, FIELD> actual) Create assumption forAtomicReferenceFieldUpdater.static <VALUE> AtomicStampedReferenceAssert<VALUE> assumeThat(AtomicStampedReference<VALUE> actual) Create assumption forAtomicStampedReference.static LongAdderAssertassumeThat(LongAdder actual) Create assumption forLongAdder.static <RESULT> CompletableFutureAssert<RESULT> assumeThat(CompletableFuture<RESULT> actual) Creates a new instance ofCompletableFutureAssertassumption.static <RESULT> CompletableFutureAssert<RESULT> assumeThat(CompletionStage<RESULT> actual) Creates a new instance ofCompletableFutureAssertassumption for aCompletionStageby converting it to aCompletableFutureand returning aCompletableFutureAssert.static <RESULT> AbstractFutureAssert<?, ? extends Future<? extends RESULT>, RESULT> assumeThat(Future<RESULT> future) Create assertion forFutureAssertassumption.static AbstractDateAssert<?> assumeThat(Date actual) Creates a new instance ofassumption.DateAssertstatic DoublePredicateAssertassumeThat(DoublePredicate actual) Creates a new instance ofDoublePredicateAssertassumption.static IntPredicateAssertassumeThat(IntPredicate actual) Creates a new instance ofIntPredicateAssertassumption.static LongPredicateAssertassumeThat(LongPredicate actual) Creates a new instance ofLongPredicateAssertassumption.static <T> PredicateAssert<T> assumeThat(Predicate<T> actual) Creates a new instance ofPredicateAssertassumption.static <ELEMENT> IteratorAssert<ELEMENT> assumeThat(Iterator<? extends ELEMENT> actual) Creates a new instance ofassumption.IteratorAssertstatic <ELEMENT> FactoryBasedNavigableListAssert<ListAssert<ELEMENT>, List<? extends ELEMENT>, ELEMENT, ObjectAssert<ELEMENT>> assumeThat(List<? extends ELEMENT> actual) Creates a new instance ofassumption.ListAssertstatic <K,V> MapAssert <K, V> assumeThat(Map<K, V> actual) Creates a new instance ofassumption.MapAssertstatic <VALUE> OptionalAssert<VALUE> assumeThat(Optional<VALUE> actual) Creates a new instance ofOptionalAssertassumption.static OptionalDoubleAssertassumeThat(OptionalDouble actual) Creates a new instance ofOptionalDoubleAssertassumption.static OptionalIntAssertassumeThat(OptionalInt actual) Creates a new instance ofOptionalIntAssertassumption.static OptionalLongAssertassumeThat(OptionalLong actual) Creates a new instance ofOptionalLongAssertassumption.static MatcherAssertassumeThat(Matcher actual) Creates a new instance ofMatcherAssertassumption.static <ELEMENT> AbstractSpliteratorAssert<?, ELEMENT> assumeThat(Spliterator<ELEMENT> actual) Creates a new instance ofassumption from the givenSpliteratorAssertSpliterator.static AbstractListAssert<?, List<? extends Double>, Double, ObjectAssert<Double>> assumeThat(DoubleStream actual) Creates a new instance ofassumption from the givenListAssertDoubleStream.static AbstractListAssert<?, List<? extends Integer>, Integer, ObjectAssert<Integer>> assumeThat(IntStream actual) Creates a new instance ofassumption from the givenListAssertIntStream.static AbstractListAssert<?, List<? extends Long>, Long, ObjectAssert<Long>> assumeThat(LongStream actual) Creates a new instance ofassumption from the givenListAssertLongStream.static <ELEMENT> AbstractListAssert<?, List<? extends ELEMENT>, ELEMENT, ObjectAssert<ELEMENT>> assumeThat(Stream<? extends ELEMENT> actual) Creates a new instance ofassumption from the givenListAssertStream.static <T> ObjectAssert<T> assumeThat(T actual) Creates a new instance ofassumption.ObjectAssertstatic <T> ObjectArrayAssert<T> assumeThat(T[] actual) Creates a new instance ofassumption.ObjectArrayAssertstatic <T> Object2DArrayAssert<T> assumeThat(T[][] actual) Creates a new instance ofassumption.Object2DArrayAssertstatic AbstractCharSequenceAssert<?, ? extends CharSequence> assumeThatCharSequence(CharSequence actual) Creates a new instance ofassumption.CharSequenceAssertstatic AbstractThrowableAssert<?, ? extends Throwable> assumeThatCode(ThrowableAssert.ThrowingCallable shouldRaiseOrNotThrowable) Allows to capture and then assume on aThrowable(easier done with lambdas).static <E> AbstractCollectionAssert<?, Collection<? extends E>, E, ObjectAssert<E>> assumeThatCollection(Collection<? extends E> actual) Creates a new instance ofassumption.CollectionAssertstatic <T> AbstractUniversalComparableAssert<?, T> assumeThatComparable(Comparable<T> actual) Creates a new instance ofassumption.UniversalComparableAssertstatic ThrowableTypeAssert<Exception> Alias forassumeThatExceptionOfType(Class)forException.static <T extends Throwable>
ThrowableTypeAssert<T> assumeThatExceptionOfType(Class<? extends T> exceptionType) Entry point to check that an exception of type T is thrown by a giventhrowingCallablewhich allows to chain assertions on the thrown exception.Alias forassumeThatExceptionOfType(Class)forIllegalArgumentException.Alias forassumeThatExceptionOfType(Class)forIndexOutOfBoundsException.static ThrowableTypeAssert<IOException> Alias forassumeThatExceptionOfType(Class)forIOException.static <ELEMENT> IterableAssert<ELEMENT> assumeThatIterable(Iterable<? extends ELEMENT> actual) Creates a new instance ofassumption.IterableAssertstatic <ELEMENT> IteratorAssert<ELEMENT> assumeThatIterator(Iterator<? extends ELEMENT> actual) Creates a new instance ofassumption.IteratorAssertstatic <ELEMENT> FactoryBasedNavigableListAssert<ListAssert<ELEMENT>, List<? extends ELEMENT>, ELEMENT, ObjectAssert<ELEMENT>> assumeThatList(List<? extends ELEMENT> actual) Creates a new instance ofassumption.ListAssertAlias forassumeThatExceptionOfType(Class)forNullPointerException.static <T> ObjectAssert<T> assumeThatObject(T actual) Creates a new instance ofassumption.ObjectAssertstatic AbstractPathAssert<?> assumeThatPath(Path actual) Creates a new instance ofassumption.PathAssertstatic <T> PredicateAssert<T> assumeThatPredicate(Predicate<T> actual) Creates a new instance ofassumption.PredicateAssertAlias forassumeThatExceptionOfType(Class)forReflectiveOperationException.static ThrowableTypeAssert<RuntimeException> Alias forassumeThatExceptionOfType(Class)forRuntimeException.static <ELEMENT> AbstractListAssert<?, List<? extends ELEMENT>, ELEMENT, ObjectAssert<ELEMENT>> assumeThatStream(Stream<? extends ELEMENT> actual) Creates a new instance ofassumption from the givenListAssertStream.static TemporalAssertassumeThatTemporal(Temporal actual) Creates a new instance ofTemporalAssertassumption.static AbstractThrowableAssert<?, ? extends Throwable> assumeThatThrownBy(ThrowableAssert.ThrowingCallable shouldRaiseThrowable) Allows to capture and then assume on aThrowable(easier done with lambdas).protected static <ASSERTION>
Class<? extends ASSERTION> generateAssumptionClass(Class<ASSERTION> assertionType) static voidsetPreferredAssumptionException(PreferredAssumptionException preferredAssumptionException) Sets which exception is thrown if an assumption is not met.
-
Constructor Details
-
Assumptions
public Assumptions()
-
-
Method Details
-
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.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.UriAssert- 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.UrlAssert- 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.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.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.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.CharSequenceAssert- Parameters:
actual- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThatCharSequence
public static AbstractCharSequenceAssert<?,? extends CharSequence> assumeThatCharSequence(CharSequence actual) Creates a new instance ofassumption.CharSequenceAssertUse this over
assumeThat(CharSequence)in case of ambiguous method resolution when the object under test implements several interfaces Assertj providesassumeThatfor.- Parameters:
actual- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 3.25.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.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.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.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.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.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.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.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.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.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.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.Float2DArrayAssert- Parameters:
actual- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 3.17.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
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
Create assumption forAtomicBoolean.- Parameters:
actual- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Create assumption forAtomicInteger.- Parameters:
actual- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
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
public static <OBJECT> AtomicIntegerFieldUpdaterAssert<OBJECT> assumeThat(AtomicIntegerFieldUpdater<OBJECT> actual) Create assumption forAtomicIntegerFieldUpdater.- Type Parameters:
OBJECT- the type of the object holding the updatable field.- Parameters:
actual- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Create assumption forLongAdder.- Parameters:
actual- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 3.16.0
-
assumeThat
Create assumption forAtomicLong.- Parameters:
actual- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Create assumption forAtomicLongArray.- Parameters:
actual- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
public static <OBJECT> AtomicLongFieldUpdaterAssert<OBJECT> assumeThat(AtomicLongFieldUpdater<OBJECT> actual) Create assumption forAtomicLongFieldUpdater.- Type Parameters:
OBJECT- the type of the object holding the updatable field.- Parameters:
actual- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Create assumption forAtomicReference.- Type Parameters:
VALUE- the type of the value contained in theAtomicReference.- Parameters:
actual- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
public static <ELEMENT> AtomicReferenceArrayAssert<ELEMENT> assumeThat(AtomicReferenceArray<ELEMENT> actual) Create assumption forAtomicReferenceArray.- Type Parameters:
ELEMENT- the type of the value contained in theAtomicReferenceArray.- Parameters:
actual- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
public static <FIELD,OBJECT> AtomicReferenceFieldUpdaterAssert<FIELD,OBJECT> assumeThat(AtomicReferenceFieldUpdater<OBJECT, FIELD> actual) Create assumption forAtomicReferenceFieldUpdater.- 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 assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
public static <VALUE> AtomicMarkableReferenceAssert<VALUE> assumeThat(AtomicMarkableReference<VALUE> actual) Create assumption forAtomicMarkableReference.- Type Parameters:
VALUE- the type of the value contained in theAtomicMarkableReference.- Parameters:
actual- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
public static <VALUE> AtomicStampedReferenceAssert<VALUE> assumeThat(AtomicStampedReference<VALUE> actual) Create assumption forAtomicStampedReference.- Type Parameters:
VALUE- the type of the value contained in theAtomicStampedReference.- 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.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.FileAssert- Parameters:
actual- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance ofPathAssertassumption.- Parameters:
actual- the path to test- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThatPath
Creates a new instance ofassumption.PathAssertUse this over
assumeThat(Path)in case of ambiguous method resolution when the object under test implements several interfaces Assertj providesassumeThatfor.- Parameters:
actual- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 3.23.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
public static <RESULT> AbstractFutureAssert<?,? extends Future<? extends RESULT>, assumeThatRESULT> (Future<RESULT> future) Create assertion forFutureAssertassumption.- Type Parameters:
RESULT- the type of the value contained in theFuture.- Parameters:
future- 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
-
assumeThatIterable
public static <ELEMENT> IterableAssert<ELEMENT> assumeThatIterable(Iterable<? extends ELEMENT> actual) Creates a new instance ofassumption.IterableAssertUse this over
assumeThat(Iterable)in case of ambiguous method resolution when the object under test implements several interfaces Assertj providesassumeThatfor.- Type Parameters:
ELEMENT- the type of elements.- Parameters:
actual- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 3.23.0
-
assumeThat
Creates a new instance ofassumption.IteratorAssert- 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
-
assumeThatIterator
public static <ELEMENT> IteratorAssert<ELEMENT> assumeThatIterator(Iterator<? extends ELEMENT> actual) Creates a new instance ofassumption.IteratorAssertUse this over
assumeThat(Iterator)in case of ambiguous method resolution when the object under test implements several interfaces Assertj providesassumeThatfor.- Type Parameters:
ELEMENT- the type of elements.- Parameters:
actual- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 3.23.0
-
assumeThat
public static <E> AbstractCollectionAssert<?,Collection<? extends E>, assumeThatE, ObjectAssert<E>> (Collection<? extends E> actual) Creates a new instance ofassumption.CollectionAssert- Type Parameters:
E- the type of elements.- Parameters:
actual- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 3.21.0
-
assumeThatCollection
public static <E> AbstractCollectionAssert<?,Collection<? extends E>, assumeThatCollectionE, ObjectAssert<E>> (Collection<? extends E> actual) Creates a new instance ofassumption.CollectionAssertUse this over
assumeThat(Collection)in case of ambiguous method resolution when the object under test implements several interfaces Assertj providesassumeThatfor.- Type Parameters:
E- the type of elements.- Parameters:
actual- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 3.23.0
-
assumeThat
public static <ELEMENT> FactoryBasedNavigableListAssert<ListAssert<ELEMENT>,List<? extends ELEMENT>, assumeThatELEMENT, ObjectAssert<ELEMENT>> (List<? extends ELEMENT> actual) Creates a new instance ofassumption.ListAssert- 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
-
assumeThatList
public static <ELEMENT> FactoryBasedNavigableListAssert<ListAssert<ELEMENT>,List<? extends ELEMENT>, assumeThatListELEMENT, ObjectAssert<ELEMENT>> (List<? extends ELEMENT> actual) Creates a new instance ofassumption.ListAssertUse this over
assumeThat(List)in case of ambiguous method resolution when the object under test implements several interfaces Assertj providesassumeThatfor.- Type Parameters:
ELEMENT- the type of elements.- Parameters:
actual- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 3.23.0
-
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.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
-
assumeThatComparable
Creates a new instance ofassumption.UniversalComparableAssertUse this over
assumeThat(Comparable)in case of ambiguous method resolution when the object under test implements several interfaces Assertj providesassumeThatfor.- Type Parameters:
T- the type of actual.- Parameters:
actual- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 3.23.0
-
assumeThat
Creates a new instance ofassumption.ThrowableAssert- Type Parameters:
T- the type of the actual throwable.- Parameters:
actual- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThatExceptionOfType
public static <T extends Throwable> ThrowableTypeAssert<T> assumeThatExceptionOfType(Class<? extends T> exceptionType) Entry point to check that an exception of type T is thrown by a giventhrowingCallablewhich allows to chain assertions on the thrown exception.- Type Parameters:
T- the exception type.- Parameters:
exceptionType- the exception type class.- Returns:
- the created
ThrowableTypeAssert. - Since:
- 3.23.0
-
assumeThatException
Alias forassumeThatExceptionOfType(Class)forException.- Returns:
- the created assumption for assertion object.
- Since:
- 3.23.0
-
assumeThatRuntimeException
Alias forassumeThatExceptionOfType(Class)forRuntimeException.- Returns:
- the created assumption for assertion object.
- Since:
- 3.23.0
-
assumeThatNullPointerException
Alias forassumeThatExceptionOfType(Class)forNullPointerException.- Returns:
- the created assumption for assertion object.
- Since:
- 3.23.0
-
assumeThatIllegalArgumentException
Alias forassumeThatExceptionOfType(Class)forIllegalArgumentException.- Returns:
- the created assumption for assertion object.
- Since:
- 3.23.0
-
assumeThatIOException
Alias forassumeThatExceptionOfType(Class)forIOException.- Returns:
- the created assumption for assertion object.
- Since:
- 3.23.0
-
assumeThatIndexOutOfBoundsException
Alias forassumeThatExceptionOfType(Class)forIndexOutOfBoundsException.- Returns:
- the created assumption for assertion object.
- Since:
- 3.23.0
-
assumeThatReflectiveOperationException
public static ThrowableTypeAssert<ReflectiveOperationException> assumeThatReflectiveOperationException()Alias forassumeThatExceptionOfType(Class)forReflectiveOperationException.- Returns:
- the created assumption for assertion object.
- Since:
- 3.23.0
-
assumeThatThrownBy
public static 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
public static AbstractThrowableAssert<?,? extends Throwable> assumeThatCode(ThrowableAssert.ThrowingCallable shouldRaiseOrNotThrowable) Allows to capture and then assume on aThrowable(easier done with lambdas).The main difference with
assumeThatThrownBy(ThrowingCallable)is that this method does not fail if no exception was thrown.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
ThrowableAssert. - Since:
- 3.9.0
-
assumeThatObject
Creates a new instance ofassumption.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:
actual- the Predicate to test- Returns:
- the created assumption for assertion object.
- Since:
- 3.9.0
-
assumeThatPredicate
Creates a new instance ofassumption.PredicateAssertUse this over
assumeThat(Predicate)in case of ambiguous method resolution when the object under test implements several interfaces Assertj providesassumeThatfor.- Type Parameters:
T- the type of elements.- Parameters:
actual- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 3.23.0
-
assumeThat
Creates a new instance ofIntPredicateAssertassumption.- Parameters:
actual- the IntPredicate to test- Returns:
- the created assumption for assertion object.
- Since:
- 3.9.0
-
assumeThat
Creates a new instance ofLongPredicateAssertassumption.- Parameters:
actual- the LongPredicate to test- Returns:
- the created assumption for assertion object.
- Since:
- 3.9.0
-
assumeThat
Creates a new instance ofDoublePredicateAssertassumption.- Parameters:
actual- the DoublePredicate to test- 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:
actual- 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:
actual- the Optional to test- Returns:
- the created assumption for assertion object.
- Since:
- 3.9.0
-
assumeThat
Creates a new instance ofOptionalDoubleAssertassumption.- Parameters:
actual- the OptionalDouble to test- Returns:
- the created assumption for assertion object.
- Since:
- 3.9.0
-
assumeThat
Creates a new instance ofMatcherAssertassumption.- Parameters:
actual- the Matcher to test- Returns:
- the created assumption for assertion object.
-
assumeThat
Creates a new instance ofOptionalIntAssertassumption.- Parameters:
actual- the OptionalInt to test- Returns:
- the created assumption for assertion object.
- Since:
- 3.9.0
-
assumeThat
Creates a new instance ofOptionalLongAssertassumption.- Parameters:
actual- the OptionalLong to test- Returns:
- the created assumption for assertion object.
- Since:
- 3.9.0
-
assumeThatTemporal
Creates a new instance ofTemporalAssertassumption.- Parameters:
actual- the Temporal to test- Returns:
- the created assumption for the given object.
- Since:
- 3.26.1
-
assumeThat
Creates a new instance ofZonedDateTimeAssertassumption.- Parameters:
actual- the ZonedDateTime to test- Returns:
- the created assumption for assertion object.
- Since:
- 3.9.0
-
assumeThat
Creates a new instance ofLocalDateTimeAssertassumption.- Parameters:
actual- the LocalDateTime to test- Returns:
- the created assumption for assertion object.
- Since:
- 3.9.0
-
assumeThat
Creates a new instance ofOffsetDateTimeAssertassumption.- Parameters:
actual- the OffsetDateTime to test- Returns:
- the created assumption for assertion object.
- Since:
- 3.9.0
-
assumeThat
Creates a new instance ofOffsetTimeAssertassumption.- Parameters:
actual- the LocalTime to test- Returns:
- the created assumption for assertion object.
- Since:
- 3.9.0
-
assumeThat
Creates a new instance ofLocalTimeAssertassumption.- Parameters:
actual- the LocalTime to test- Returns:
- the created assumption for assertion object.
- Since:
- 3.9.0
-
assumeThat
Creates a new instance ofLocalDateAssertassumption.- Parameters:
actual- the LocalDate to test- Returns:
- the created assumption for assertion object.
- Since:
- 3.9.0
-
assumeThat
Creates a new instance ofYearMonthAssertassumption.- Parameters:
actual- the YearMonth to test- Returns:
- the created assumption for assertion object.
- Since:
- 3.26.0
-
assumeThat
Creates a new instance ofInstantAssertassumption.- Parameters:
actual- the Instant to test- Returns:
- the created assumption for assertion object.
- Since:
- 3.9.0
-
assumeThat
Creates a new instance ofDurationAssertassumption.- Parameters:
actual- the Duration to test- Returns:
- the created assumption for assertion object.
- Since:
- 3.15.0
-
assumeThat
Creates a new instance ofPeriodAssertassumption.- Parameters:
actual- the Period to test- Returns:
- the created assumption for assertion object.
- Since:
- 3.17.0
-
assumeThat
public static <ELEMENT> AbstractListAssert<?,List<? extends ELEMENT>, assumeThatELEMENT, ObjectAssert<ELEMENT>> (Stream<? extends ELEMENT> actual) Creates a new instance ofassumption from the givenListAssertStream.- Type Parameters:
ELEMENT- the type of elements.- Parameters:
actual- the Stream to test- Returns:
- the created assumption for assertion object.
- Since:
- 3.9.0
-
assumeThatStream
public static <ELEMENT> AbstractListAssert<?,List<? extends ELEMENT>, assumeThatStreamELEMENT, ObjectAssert<ELEMENT>> (Stream<? extends ELEMENT> actual) Creates a new instance ofassumption from the givenListAssertStream.Use this over
assumeThat(Stream)in case of ambiguous method resolution when the object under test implements several interfaces Assertj providesassumeThatfor.- Type Parameters:
ELEMENT- the type of elements.- Parameters:
actual- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 3.23.0
-
assumeThat
public static AbstractListAssert<?,List<? extends Double>, assumeThatDouble, ObjectAssert<Double>> (DoubleStream actual) Creates a new instance ofassumption from the givenListAssertDoubleStream.- Parameters:
actual- the DoubleStream to test- Returns:
- the created assumption for assertion object.
- Since:
- 3.9.0
-
assumeThat
public static AbstractListAssert<?,List<? extends Long>, assumeThatLong, ObjectAssert<Long>> (LongStream actual) Creates a new instance ofassumption from the givenListAssertLongStream.- Parameters:
actual- the LongStream to test- Returns:
- the created assumption for assertion object.
- Since:
- 3.9.0
-
assumeThat
public static AbstractListAssert<?,List<? extends Integer>, assumeThatInteger, ObjectAssert<Integer>> (IntStream actual) Creates a new instance ofassumption from the givenListAssertIntStream.- Parameters:
actual- the LongStream to test- Returns:
- the created assumption for assertion object.
- Since:
- 3.9.0
-
assumeThat
public static <ELEMENT> AbstractSpliteratorAssert<?,ELEMENT> assumeThat(Spliterator<ELEMENT> actual) Creates a new instance ofassumption from the givenSpliteratorAssertSpliterator.- Type Parameters:
ELEMENT- the type of the elements- Parameters:
actual- the Spliterator to test- Returns:
- the created assumption for assertion object.
-
setPreferredAssumptionException
public static 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
-
generateAssumptionClass
-