public interface WithAssumptions
| Modifier and Type | Method and Description |
|---|---|
default AtomicBooleanAssert |
assumeThat(AtomicBoolean actual)
Creates a new instance of
assumption. |
default AtomicIntegerAssert |
assumeThat(AtomicInteger actual)
Creates a new instance of
assumption. |
default AtomicIntegerArrayAssert |
assumeThat(AtomicIntegerArray actual)
Creates int[] assumption for
AtomicIntegerArray. |
default <OBJECT> AtomicIntegerFieldUpdaterAssert<OBJECT> |
assumeThat(AtomicIntegerFieldUpdater<OBJECT> actual)
Creates a new instance of
assumption. |
default AtomicLongAssert |
assumeThat(AtomicLong actual)
Creates a new instance of
assumption. |
default AtomicLongArrayAssert |
assumeThat(AtomicLongArray actual)
Creates a new instance of
assumption. |
default <OBJECT> AtomicLongFieldUpdaterAssert<OBJECT> |
assumeThat(AtomicLongFieldUpdater<OBJECT> actual)
Creates a new instance of
assumption. |
default <VALUE> AtomicMarkableReferenceAssert<VALUE> |
assumeThat(AtomicMarkableReference<VALUE> actual)
Creates a new instance of
assumption. |
default <VALUE> AtomicReferenceAssert<VALUE> |
assumeThat(AtomicReference<VALUE> actual)
Creates a new instance of
assumption. |
default <ELEMENT> AtomicReferenceArrayAssert<ELEMENT> |
assumeThat(AtomicReferenceArray<ELEMENT> actual)
Creates a new instance of
assumption. |
default <FIELD,OBJECT> |
assumeThat(AtomicReferenceFieldUpdater<OBJECT,FIELD> actual)
Creates a new instance of
assumption. |
default <VALUE> AtomicStampedReferenceAssert<VALUE> |
assumeThat(AtomicStampedReference<VALUE> actual)
Creates a new instance of
assumption. |
default AbstractBigDecimalAssert<?> |
assumeThat(BigDecimal actual)
Creates a new instance of
assumption. |
default AbstractBigIntegerAssert<?> |
assumeThat(BigInteger actual)
Creates a new instance of
assumption. |
default AbstractBooleanAssert<?> |
assumeThat(boolean actual)
Creates a new instance of
assumption. |
default AbstractBooleanAssert<?> |
assumeThat(Boolean actual)
Creates a new instance of
assumption. |
default AbstractBooleanArrayAssert<?> |
assumeThat(boolean[] actual)
Creates a new instance of
assumption. |
default Boolean2DArrayAssert |
assumeThat(boolean[][] actual)
Creates a new instance of
assumption. |
default AbstractByteAssert<?> |
assumeThat(byte actual)
Creates a new instance of
assumption. |
default AbstractByteAssert<?> |
assumeThat(Byte actual)
Creates a new instance of
assumption. |
default AbstractByteArrayAssert<?> |
assumeThat(byte[] actual)
Creates a new instance of
assumption. |
default Byte2DArrayAssert |
assumeThat(byte[][] actual)
Creates a new instance of
assumption. |
default AbstractCharacterAssert<?> |
assumeThat(char actual)
Creates a new instance of
assumption. |
default AbstractCharArrayAssert<?> |
assumeThat(char[] actual)
Creates a new instance of
assumption. |
default Char2DArrayAssert |
assumeThat(char[][] actual)
Creates a new instance of
assumption. |
default AbstractCharacterAssert<?> |
assumeThat(Character actual)
Creates a new instance of
assumption. |
default AbstractCharSequenceAssert<?,? extends CharSequence> |
assumeThat(CharSequence actual)
Creates a new instance of
assumption. |
default ClassAssert |
assumeThat(Class<?> actual)
Creates a new instance of
assumption. |
default <RESULT> CompletableFutureAssert<RESULT> |
assumeThat(CompletableFuture<RESULT> future)
Creates a new instance of
CompletableFutureAssert assumption. |
default <RESULT> CompletableFutureAssert<RESULT> |
assumeThat(CompletionStage<RESULT> actual)
Creates a new instance of
CompletableFutureAssert assumption for a CompletionStage
by converting it to a CompletableFuture and returning a CompletableFutureAssert. |
default AbstractDateAssert<?> |
assumeThat(Date actual)
Creates a new instance of
assumption. |
default AbstractDoubleAssert<?> |
assumeThat(double actual)
Creates a new instance of
assumption. |
default AbstractDoubleAssert<?> |
assumeThat(Double actual)
Creates a new instance of
assumption. |
default AbstractDoubleArrayAssert<?> |
assumeThat(double[] actual)
Creates a new instance of
assumption. |
default Double2DArrayAssert |
assumeThat(double[][] actual)
Creates a new instance of
assumption. |
default DoublePredicateAssert |
assumeThat(DoublePredicate doublePredicate)
Creates a new instance of
DoublePredicateAssert assumption. |
default AbstractListAssert<?,List<? extends Double>,Double,ObjectAssert<Double>> |
assumeThat(DoubleStream doubleStream)
Creates a new instance of
assumption from the given DoubleStream. |
default AbstractDurationAssert<?> |
assumeThat(Duration duration)
Creates a new instance of
assumption. |
default AbstractFileAssert<?> |
assumeThat(File actual)
Creates a new instance of
assumption. |
default AbstractFloatAssert<?> |
assumeThat(float actual)
Creates a new instance of
assumption. |
default AbstractFloatAssert<?> |
assumeThat(Float actual)
Creates a new instance of
assumption. |
default AbstractFloatArrayAssert<?> |
assumeThat(float[] actual)
Creates a new instance of
assumption. |
default Float2DArrayAssert |
assumeThat(float[][] actual)
Creates a new instance of
assumption. |
default <RESULT> AbstractFutureAssert<?,? extends Future<? extends RESULT>,RESULT> |
assumeThat(Future<RESULT> actual)
Create assertion for
FutureAssert assumption. |
default AbstractInputStreamAssert<?,? extends InputStream> |
assumeThat(InputStream actual)
Creates a new instance of
assumption. |
default AbstractInstantAssert<?> |
assumeThat(Instant instant)
Creates a new instance of
assumption. |
default AbstractIntegerAssert<?> |
assumeThat(int actual)
Creates a new instance of
assumption. |
default AbstractIntArrayAssert<?> |
assumeThat(int[] actual)
Creates a new instance of
assumption. |
default Int2DArrayAssert |
assumeThat(int[][] actual)
Creates a new instance of
assumption. |
default AbstractIntegerAssert<?> |
assumeThat(Integer actual)
Creates a new instance of
assumption. |
default IntPredicateAssert |
assumeThat(IntPredicate intPredicate)
Creates a new instance of
IntPredicateAssert assumption. |
default AbstractListAssert<?,List<? extends Integer>,Integer,ObjectAssert<Integer>> |
assumeThat(IntStream intStream)
Creates a new instance of
assumption from the given IntStream. |
default <ELEMENT> IterableAssert<ELEMENT> |
assumeThat(Iterable<? extends ELEMENT> actual)
Creates a new instance of
assumption. |
default <ELEMENT> IteratorAssert<ELEMENT> |
assumeThat(Iterator<? extends ELEMENT> actual)
Creates a new instance of
assumption. |
default <ELEMENT> FactoryBasedNavigableListAssert<ListAssert<ELEMENT>,List<? extends ELEMENT>,ELEMENT,ObjectAssert<ELEMENT>> |
assumeThat(List<? extends ELEMENT> list)
Creates a new instance of
assumption. |
default AbstractLocalDateAssert<?> |
assumeThat(LocalDate localDate)
Creates a new instance of
assumption. |
default AbstractLocalDateTimeAssert<?> |
assumeThat(LocalDateTime localDateTime)
Creates a new instance of
assumption. |
default AbstractLocalTimeAssert<?> |
assumeThat(LocalTime localTime)
Creates a new instance of
assumption. |
default AbstractLongAssert<?> |
assumeThat(long actual)
Creates a new instance of
assumption. |
default AbstractLongAssert<?> |
assumeThat(Long actual)
Creates a new instance of
assumption. |
default AbstractLongArrayAssert<?> |
assumeThat(long[] actual)
Creates a new instance of
assumption. |
default Long2DArrayAssert |
assumeThat(long[][] actual)
Creates a new instance of
assumption. |
default LongAdderAssert |
assumeThat(LongAdder actual)
Creates a new instance of
assumption. |
default LongPredicateAssert |
assumeThat(LongPredicate longPredicate)
Creates a new instance of
LongPredicateAssert assumption. |
default AbstractListAssert<?,List<? extends Long>,Long,ObjectAssert<Long>> |
assumeThat(LongStream longStream)
Creates a new instance of
assumption from the given LongStream. |
default <K,V> MapAssert<K,V> |
assumeThat(Map<K,V> actual)
Creates a new instance of
assumption. |
default MatcherAssert |
assumeThat(Matcher matcher)
Creates a new instance of
assumption. |
default AbstractOffsetDateTimeAssert<?> |
assumeThat(OffsetDateTime offsetDateTime)
Creates a new instance of
assumption. |
default AbstractOffsetTimeAssert<?> |
assumeThat(OffsetTime offsetTime)
Creates a new instance of
assumption. |
default <VALUE> OptionalAssert<VALUE> |
assumeThat(Optional<VALUE> optional)
Creates a new instance of
OptionalAssert assumption. |
default OptionalDoubleAssert |
assumeThat(OptionalDouble optionalDouble)
Creates a new instance of
assumption. |
default OptionalIntAssert |
assumeThat(OptionalInt optionalInt)
Creates a new instance of
assumption. |
default OptionalLongAssert |
assumeThat(OptionalLong optionalLong)
Creates a new instance of
assumption. |
default AbstractPathAssert<?> |
assumeThat(Path actual)
Creates a new instance of
assumption. |
default AbstractPeriodAssert<?> |
assumeThat(Period period)
Creates a new instance of
assumption. |
default <T> PredicateAssert<T> |
assumeThat(Predicate<T> predicate)
Creates a new instance of
PredicateAssert assumption. |
default AbstractShortAssert<?> |
assumeThat(short actual)
Creates a new instance of
assumption. |
default AbstractShortAssert<?> |
assumeThat(Short actual)
Creates a new instance of
assumption. |
default AbstractShortArrayAssert<?> |
assumeThat(short[] actual)
Creates a new instance of
assumption. |
default Short2DArrayAssert |
assumeThat(short[][] actual)
Creates a new instance of
assumption. |
default <ELEMENT> AbstractSpliteratorAssert<?,ELEMENT> |
assumeThat(Spliterator<ELEMENT> spliterator)
Creates a new instance of
assumption. |
default <ELEMENT> AbstractListAssert<?,List<? extends ELEMENT>,ELEMENT,ObjectAssert<ELEMENT>> |
assumeThat(Stream<? extends ELEMENT> stream)
Creates a new instance of
assumption from the given Stream. |
default AbstractStringAssert<?> |
assumeThat(String actual)
Creates a new instance of
assumption. |
default AbstractCharSequenceAssert<?,? extends CharSequence> |
assumeThat(StringBuffer actual)
Creates a new instance of
assumption from a StringBuffer. |
default AbstractCharSequenceAssert<?,? extends CharSequence> |
assumeThat(StringBuilder actual)
Creates a new instance of
assumption from a StringBuilder. |
default <T> ObjectAssert<T> |
assumeThat(T actual)
Creates a new instance of
assumption. |
default <T extends Comparable<? super T>> |
assumeThat(T actual)
Creates a new instance of
assumption. |
default <T extends Throwable> |
assumeThat(T actual)
Creates a new instance of
assumption. |
default <T> ObjectArrayAssert<T> |
assumeThat(T[] actual)
Creates a new instance of
assumption. |
default <T> Object2DArrayAssert<T> |
assumeThat(T[][] actual)
Creates a new instance of
assumption. |
default AbstractUriAssert<?> |
assumeThat(URI uri)
Creates a new instance of
assumption. |
default AbstractUrlAssert<?> |
assumeThat(URL url)
Creates a new instance of
assumption. |
default AbstractZonedDateTimeAssert<?> |
assumeThat(ZonedDateTime zonedDateTime)
Creates a new instance of
assumption. |
default AbstractThrowableAssert<?,? extends Throwable> |
assumeThatCode(ThrowableAssert.ThrowingCallable shouldRaiseOrNotThrowable)
Allows to capture and then assume on a
Throwable (easier done with lambdas). |
default <T> ObjectAssert<T> |
assumeThatObject(T actual)
Creates a new instance of
for any object. |
default AbstractThrowableAssert<?,? extends Throwable> |
assumeThatThrownBy(ThrowableAssert.ThrowingCallable shouldRaiseThrowable)
Allows to capture and then assume on a
Throwable (easier done with lambdas). |
default void |
setPreferredAssumptionException(PreferredAssumptionException preferredAssumptionException)
Sets which exception is thrown if an assumption is not met.
|
default <T> ObjectArrayAssert<T> assumeThat(T[] actual)
ObjectArrayAssert assumption.T - the type of elements.actual - the actual value.default <T> Object2DArrayAssert<T> assumeThat(T[][] actual)
Object2DArrayAssert assumption.T - the type of elements.actual - the actual value.default <K,V> MapAssert<K,V> assumeThat(Map<K,V> actual)
MapAssert assumption.K - the type of keys in the map.V - the type of values in the map.actual - the actual value.default AbstractShortAssert<?> assumeThat(short actual)
ShortAssert assumption.actual - the actual value.default AbstractLongAssert<?> assumeThat(long actual)
LongAssert assumption.actual - the actual value.default AbstractLongAssert<?> assumeThat(Long actual)
LongAssert assumption.actual - the actual value.default AbstractLongArrayAssert<?> assumeThat(long[] actual)
LongArrayAssert assumption.actual - the actual value.default Long2DArrayAssert assumeThat(long[][] actual)
Long2DArrayAssert assumption.actual - the actual value.default <T> ObjectAssert<T> assumeThat(T actual)
ObjectAssert assumption.T - the type of the actual value.actual - the actual value.default AbstractStringAssert<?> assumeThat(String actual)
StringAssert assumption.actual - the actual value.default AbstractDateAssert<?> assumeThat(Date actual)
DateAssert assumption.actual - the actual value.default <T extends Throwable> AbstractThrowableAssert<?,T> assumeThat(T actual)
ThrowableAssert assumption.T - the type of the actual value.actual - the actual value.default AbstractBigDecimalAssert<?> assumeThat(BigDecimal actual)
BigDecimalAssert assumption.actual - the actual value.default AbstractBigIntegerAssert<?> assumeThat(BigInteger actual)
BigIntegerAssert assumption.actual - the actual value.default AtomicBooleanAssert assumeThat(AtomicBoolean actual)
AtomicBooleanAssert assumption.actual - the actual value.default AtomicIntegerAssert assumeThat(AtomicInteger actual)
AtomicIntegerAssert assumption.actual - the actual value.default AtomicIntegerArrayAssert assumeThat(AtomicIntegerArray actual)
AtomicIntegerArray.actual - the actual value.default <OBJECT> AtomicIntegerFieldUpdaterAssert<OBJECT> assumeThat(AtomicIntegerFieldUpdater<OBJECT> actual)
AtomicIntegerFieldUpdaterAssert assumption.OBJECT - the type of the object holding the updatable field.actual - the actual value.default LongAdderAssert assumeThat(LongAdder actual)
LongAdderAssert assumption.actual - the actual value.default AtomicLongAssert assumeThat(AtomicLong actual)
AtomicLongAssert assumption.actual - the actual value.default AtomicLongArrayAssert assumeThat(AtomicLongArray actual)
AtomicLongArrayAssert assumption.actual - the actual value.default <OBJECT> AtomicLongFieldUpdaterAssert<OBJECT> assumeThat(AtomicLongFieldUpdater<OBJECT> actual)
AtomicLongFieldUpdaterAssert assumption.OBJECT - the type of the object holding the updatable field.actual - the actual value.default <VALUE> AtomicReferenceAssert<VALUE> assumeThat(AtomicReference<VALUE> actual)
AtomicReferenceAssert assumption.VALUE - the type of the value contained in the AtomicReference.actual - the actual value.default <ELEMENT> AtomicReferenceArrayAssert<ELEMENT> assumeThat(AtomicReferenceArray<ELEMENT> actual)
AtomicReferenceArrayAssert assumption.ELEMENT - the type of the value contained in the AtomicReferenceArray.actual - the actual value.default <FIELD,OBJECT> AtomicReferenceFieldUpdaterAssert<FIELD,OBJECT> assumeThat(AtomicReferenceFieldUpdater<OBJECT,FIELD> actual)
AtomicReferenceFieldUpdaterAssert assumption.FIELD - the type of the field which gets updated by the AtomicReferenceFieldUpdater.OBJECT - the type of the object holding the updatable field.actual - the actual value.default <VALUE> AtomicMarkableReferenceAssert<VALUE> assumeThat(AtomicMarkableReference<VALUE> actual)
AtomicMarkableReferenceAssert assumption.VALUE - the type of the value contained in the AtomicMarkableReference.actual - the actual value.default <VALUE> AtomicStampedReferenceAssert<VALUE> assumeThat(AtomicStampedReference<VALUE> actual)
AtomicStampedReferenceAssert assumption.VALUE - the type of the value contained in the AtomicStampedReference.actual - the actual value.default AbstractCharSequenceAssert<?,? extends CharSequence> assumeThat(CharSequence actual)
CharSequenceAssert assumption.actual - the actual value.default AbstractCharSequenceAssert<?,? extends CharSequence> assumeThat(StringBuilder actual)
CharSequenceAssert assumption from a StringBuilder.actual - the actual value.default AbstractCharSequenceAssert<?,? extends CharSequence> assumeThat(StringBuffer actual)
CharSequenceAssert assumption from a StringBuffer.actual - the actual value.default AbstractShortArrayAssert<?> assumeThat(short[] actual)
ShortArrayAssert assumption.actual - the actual value.default Short2DArrayAssert assumeThat(short[][] actual)
Short2DArrayAssert assumption.actual - the actual value.default AbstractShortAssert<?> assumeThat(Short actual)
ShortAssert assumption.actual - the actual value.default ClassAssert assumeThat(Class<?> actual)
ClassAssert assumption.actual - the actual value.default AbstractCharacterAssert<?> assumeThat(Character actual)
CharacterAssert assumption.actual - the actual value.default AbstractCharArrayAssert<?> assumeThat(char[] actual)
CharArrayAssert assumption.actual - the actual value.default Char2DArrayAssert assumeThat(char[][] actual)
Char2DArrayAssert assumption.actual - the actual value.default AbstractCharacterAssert<?> assumeThat(char actual)
CharacterAssert assumption.actual - the actual value.default <T extends Comparable<? super T>> AbstractComparableAssert<?,T> assumeThat(T actual)
GenericComparableAssert assumption.T - the type of actual.actual - the actual value.default <ELEMENT> IterableAssert<ELEMENT> assumeThat(Iterable<? extends ELEMENT> actual)
IterableAssert assumption.ELEMENT - the type of elements.actual - the actual value.default <ELEMENT> IteratorAssert<ELEMENT> assumeThat(Iterator<? extends ELEMENT> actual)
IteratorAssert assumption.
Breaking change in version 3.12.0: this method does not return anymore an IterableAssert but an IteratorAssert.
ELEMENT - the type of elements.actual - the actual value.default AbstractBooleanAssert<?> assumeThat(Boolean actual)
BooleanAssert assumption.actual - the actual value.default AbstractBooleanArrayAssert<?> assumeThat(boolean[] actual)
BooleanArrayAssert assumption.actual - the actual value.default Boolean2DArrayAssert assumeThat(boolean[][] actual)
Boolean2DArrayAssert assumption.actual - the actual value.default AbstractByteAssert<?> assumeThat(byte actual)
ByteAssert assumption.actual - the actual value.default AbstractByteAssert<?> assumeThat(Byte actual)
ByteAssert assumption.actual - the actual value.default AbstractByteArrayAssert<?> assumeThat(byte[] actual)
ByteArrayAssert assumption.actual - the actual value.default Byte2DArrayAssert assumeThat(byte[][] actual)
Byte2DArrayAssert assumption.actual - the actual value.default AbstractBooleanAssert<?> assumeThat(boolean actual)
BooleanAssert assumption.actual - the actual value.default AbstractFloatAssert<?> assumeThat(float actual)
FloatAssert assumption.actual - the actual value.default AbstractInputStreamAssert<?,? extends InputStream> assumeThat(InputStream actual)
InputStreamAssert assumption.actual - the actual value.default AbstractFileAssert<?> assumeThat(File actual)
FileAssert assumption.actual - the actual value.default <RESULT> AbstractFutureAssert<?,? extends Future<? extends RESULT>,RESULT> assumeThat(Future<RESULT> actual)
FutureAssert assumption.RESULT - the type of the value contained in the Future.actual - the actual value.default AbstractPathAssert<?> assumeThat(Path actual)
PathAssert assumption.actual - the actual value.default AbstractIntArrayAssert<?> assumeThat(int[] actual)
IntArrayAssert assumption.actual - the actual value.default Int2DArrayAssert assumeThat(int[][] actual)
Int2DArrayAssert assumption.actual - the actual value.default AbstractFloatAssert<?> assumeThat(Float actual)
FloatAssert assumption.actual - the actual value.default Float2DArrayAssert assumeThat(float[][] actual)
Float2DArrayAssert assumption.actual - the actual value.default AbstractIntegerAssert<?> assumeThat(int actual)
IntegerAssert assumption.actual - the actual value.default AbstractFloatArrayAssert<?> assumeThat(float[] actual)
FloatArrayAssert assumption.actual - the actual value.default AbstractIntegerAssert<?> assumeThat(Integer actual)
IntegerAssert assumption.actual - the actual value.default AbstractDoubleAssert<?> assumeThat(double actual)
DoubleAssert assumption.actual - the actual value.default AbstractDoubleAssert<?> assumeThat(Double actual)
DoubleAssert assumption.actual - the actual value.default <ELEMENT> FactoryBasedNavigableListAssert<ListAssert<ELEMENT>,List<? extends ELEMENT>,ELEMENT,ObjectAssert<ELEMENT>> assumeThat(List<? extends ELEMENT> list)
ListAssert assumption.ELEMENT - the type of elements.list - the actual value.default <ELEMENT> AbstractListAssert<?,List<? extends ELEMENT>,ELEMENT,ObjectAssert<ELEMENT>> assumeThat(Stream<? extends ELEMENT> stream)
ListAssert assumption from the given Stream.ELEMENT - the type of elements.stream - the Stream to testdefault AbstractListAssert<?,List<? extends Double>,Double,ObjectAssert<Double>> assumeThat(DoubleStream doubleStream)
ListAssert assumption from the given DoubleStream.doubleStream - the actual value.default AbstractListAssert<?,List<? extends Long>,Long,ObjectAssert<Long>> assumeThat(LongStream longStream)
ListAssert assumption from the given LongStream.longStream - the actual value.default AbstractListAssert<?,List<? extends Integer>,Integer,ObjectAssert<Integer>> assumeThat(IntStream intStream)
ListAssert assumption from the given IntStream.intStream - the actual value.default AbstractDoubleArrayAssert<?> assumeThat(double[] actual)
DoubleArrayAssert assumption.actual - the actual value.default Double2DArrayAssert assumeThat(double[][] actual)
Double2DArrayAssert assumption.actual - the actual value.default AbstractZonedDateTimeAssert<?> assumeThat(ZonedDateTime zonedDateTime)
ZonedDateTimeAssert assumption.zonedDateTime - the actual value.default <RESULT> CompletableFutureAssert<RESULT> assumeThat(CompletableFuture<RESULT> future)
CompletableFutureAssert assumption.RESULT - the CompletableFuture wrapped type.future - the CompletableFuture to testdefault <RESULT> CompletableFutureAssert<RESULT> assumeThat(CompletionStage<RESULT> actual)
CompletableFutureAssert assumption for a CompletionStage
by converting it to a CompletableFuture and returning a CompletableFutureAssert.
If the given CompletionStage is null, the CompletableFuture in the returned CompletableFutureAssert will also be null.
RESULT - the CompletableFuture wrapped type.actual - the CompletableFuture to testdefault <VALUE> OptionalAssert<VALUE> assumeThat(Optional<VALUE> optional)
OptionalAssert assumption.VALUE - the Optional wrapped type.optional - the Optional to testdefault OptionalDoubleAssert assumeThat(OptionalDouble optionalDouble)
OptionalDoubleAssert assumption.optionalDouble - the actual value.default OptionalIntAssert assumeThat(OptionalInt optionalInt)
OptionalIntAssert assumption.optionalInt - the actual value.default OptionalLongAssert assumeThat(OptionalLong optionalLong)
OptionalLongAssert assumption.optionalLong - the actual value.default MatcherAssert assumeThat(Matcher matcher)
MatcherAssert assumption.matcher - the actual Matcher.default AbstractLocalDateTimeAssert<?> assumeThat(LocalDateTime localDateTime)
LocalDateTimeAssert assumption.localDateTime - the actual value.default AbstractLocalDateAssert<?> assumeThat(LocalDate localDate)
LocalDateAssert assumption.localDate - the actual value.default AbstractLocalTimeAssert<?> assumeThat(LocalTime localTime)
LocalTimeAssert assumption.localTime - the actual value.default AbstractInstantAssert<?> assumeThat(Instant instant)
InstantAssert assumption.instant - the actual value.default AbstractDurationAssert<?> assumeThat(Duration duration)
DurationAssert assumption.duration - the actual value.default AbstractPeriodAssert<?> assumeThat(Period period)
PeriodAssert assumption.period - the actual value.default AbstractOffsetTimeAssert<?> assumeThat(OffsetTime offsetTime)
OffsetTimeAssert assumption.offsetTime - the actual value.default AbstractOffsetDateTimeAssert<?> assumeThat(OffsetDateTime offsetDateTime)
OffsetDateTimeAssert assumption.offsetDateTime - the actual value.default AbstractThrowableAssert<?,? extends Throwable> assumeThatThrownBy(ThrowableAssert.ThrowingCallable shouldRaiseThrowable)
Throwable (easier done with lambdas).
Example :
@Test
public void testException() {
assumeThatThrownBy(() -> { throw new Exception("boom!") }).isInstanceOf(Exception.class)
.hasMessageContaining("boom");
}shouldRaiseThrowable - The ThrowableAssert.ThrowingCallable or lambda with the code that should raise the throwable.default AbstractThrowableAssert<?,? extends Throwable> assumeThatCode(ThrowableAssert.ThrowingCallable shouldRaiseOrNotThrowable)
Throwable (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 :(
shouldRaiseOrNotThrowable - The ThrowableAssert.ThrowingCallable or lambda with the code that should raise the throwable.default <T> ObjectAssert<T> assumeThatObject(T actual)
ObjectAssert for any object.
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:
assumeThat(new LinkedList<>(asList("abc"))).matches(list -> ((Deque<String>) list).getFirst().equals("abc"));
No cast needed, but also no additional list assertions:
assumeThatObject(new LinkedList<>(asList("abc"))).matches(list -> list.getFirst().equals("abc")); T - the type of the actual value.actual - the actual value.default <T> PredicateAssert<T> assumeThat(Predicate<T> predicate)
PredicateAssert assumption.T - the Predicate type.predicate - the Predicate to testdefault IntPredicateAssert assumeThat(IntPredicate intPredicate)
IntPredicateAssert assumption.intPredicate - the IntPredicate to testdefault LongPredicateAssert assumeThat(LongPredicate longPredicate)
LongPredicateAssert assumption.longPredicate - the LongPredicate to testdefault DoublePredicateAssert assumeThat(DoublePredicate doublePredicate)
DoublePredicateAssert assumption.doublePredicate - the DoublePredicate to testdefault AbstractUrlAssert<?> assumeThat(URL url)
UrlAssert assumption.url - the actual value.default AbstractUriAssert<?> assumeThat(URI uri)
UriAssert assumption.uri - the actual value.default <ELEMENT> AbstractSpliteratorAssert<?,ELEMENT> assumeThat(Spliterator<ELEMENT> spliterator)
SpliteratorAssert assumption.ELEMENT - the type of the elements.spliterator - the actual value.default void setPreferredAssumptionException(PreferredAssumptionException preferredAssumptionException)
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 a org.testng.SkipException if you are using TestNGPreferredAssumptionException.JUNIT4 to throw a org.junit.AssumptionViolatedException if you are using JUnit 4PreferredAssumptionException.JUNIT5 a org.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 5preferredAssumptionException - the preferred exception to use with Assumptions.Copyright © 2025. All rights reserved.