Package org.assertj.core.api
Class Assumptions
java.lang.Object
org.assertj.core.api.Assumptions
Entry point for assumption methods for different types, which allow to skip test execution on failed assumptions.
- Since:
- 2.9.0 / 3.9.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final net.bytebuddy.implementation.Implementation
private static final net.bytebuddy.ByteBuddy
This NamingStrategy takes the original class's name and adds a suffix to distinguish it.private static final net.bytebuddy.TypeCache<net.bytebuddy.TypeCache.SimpleKey>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static <ASSERTION>
ASSERTIONasAssumption
(Class<ASSERTION> assertionType, Class<?>[] constructorTypes, Object... constructorParams) private static <ASSERTION,
ACTUAL>
ASSERTIONasAssumption
(Class<ASSERTION> assertionType, Class<ACTUAL> actualType, Object actual) private static AbstractAssert<?,
?> asAssumption
(AbstractAssert<?, ?> assertion) private static AbstractAssert<?,
?> asIterableSizeAssumption
(AbstractAssert<?, ?> assertion) private static AbstractAssert<?,
?> asMapSizeAssumption
(AbstractAssert<?, ?> assertion) private static AbstractAssert<?,
?> asRecursiveComparisonAssumption
(AbstractAssert<?, ?> assertion) static AbstractBooleanAssert<?>
assumeThat
(boolean actual) Creates a new instance of
assumption.BooleanAssert
static AbstractBooleanArrayAssert<?>
assumeThat
(boolean[] actual) Creates a new instance of
assumption.BooleanArrayAssert
static Boolean2DArrayAssert
assumeThat
(boolean[][] actual) Creates a new instance of
assumption.Boolean2DArrayAssert
static AbstractByteAssert<?>
assumeThat
(byte actual) Creates a new instance of
assumption.ByteAssert
static AbstractByteArrayAssert<?>
assumeThat
(byte[] actual) Creates a new instance of
assumption.ByteArrayAssert
static Byte2DArrayAssert
assumeThat
(byte[][] actual) Creates a new instance of
assumption.Byte2DArrayAssert
static AbstractCharacterAssert<?>
assumeThat
(char actual) Creates a new instance of
assumption.CharacterAssert
static AbstractCharArrayAssert<?>
assumeThat
(char[] actual) Creates a new instance of
assumption.CharArrayAssert
static Char2DArrayAssert
assumeThat
(char[][] actual) Creates a new instance of
assumption.Char2DArrayAssert
static AbstractDoubleAssert<?>
assumeThat
(double actual) Creates a new instance of
assumption.DoubleAssert
static AbstractDoubleArrayAssert<?>
assumeThat
(double[] actual) Creates a new instance of
assumption.DoubleArrayAssert
static Double2DArrayAssert
assumeThat
(double[][] actual) Creates a new instance of
assumption.Double2DArrayAssert
static AbstractFloatAssert<?>
assumeThat
(float actual) Creates a new instance of
assumption.FloatAssert
static AbstractFloatArrayAssert<?>
assumeThat
(float[] actual) Creates a new instance of
assumption.FloatArrayAssert
static Float2DArrayAssert
assumeThat
(float[][] actual) Creates a new instance of
assumption.Float2DArrayAssert
static AbstractIntegerAssert<?>
assumeThat
(int actual) Creates a new instance of
assumption.IntegerAssert
static AbstractIntArrayAssert<?>
assumeThat
(int[] actual) Creates a new instance of
assumption.IntArrayAssert
static Int2DArrayAssert
assumeThat
(int[][] actual) Creates a new instance of
assumption.Int2DArrayAssert
static AbstractLongAssert<?>
assumeThat
(long actual) Creates a new instance of
assumption.LongAssert
static AbstractLongArrayAssert<?>
assumeThat
(long[] actual) Creates a new instance of
assumption.LongArrayAssert
static Long2DArrayAssert
assumeThat
(long[][] actual) Creates a new instance of
assumption.Long2DArrayAssert
static AbstractShortAssert<?>
assumeThat
(short actual) Creates a new instance of
assumption.ShortAssert
static AbstractShortArrayAssert<?>
assumeThat
(short[] actual) Creates a new instance of
assumption.ShortArrayAssert
static Short2DArrayAssert
assumeThat
(short[][] actual) Creates a new instance of
assumption.Short2DArrayAssert
static AbstractFileAssert<?>
assumeThat
(File actual) Creates a new instance of
assumption.FileAssert
static AbstractInputStreamAssert<?,
? extends InputStream> assumeThat
(InputStream actual) Creates a new instance of
assumption.InputStreamAssert
static AbstractBooleanAssert<?>
assumeThat
(Boolean actual) Creates a new instance of
assumption.BooleanAssert
static AbstractByteAssert<?>
assumeThat
(Byte actual) Creates a new instance of
assumption.ByteAssert
static AbstractCharacterAssert<?>
assumeThat
(Character actual) Creates a new instance of
assumption.CharacterAssert
static AbstractCharSequenceAssert<?,
? extends CharSequence> assumeThat
(CharSequence actual) Creates a new instance of
assumption.CharSequenceAssert
static AbstractClassAssert<?>
assumeThat
(Class<?> actual) Creates a new instance of
assumption.ClassAssert
static AbstractDoubleAssert<?>
assumeThat
(Double actual) Creates a new instance of
assumption.DoubleAssert
static AbstractFloatAssert<?>
assumeThat
(Float actual) Creates a new instance of
assumption.FloatAssert
static AbstractIntegerAssert<?>
assumeThat
(Integer actual) Creates a new instance of
assumption.IntegerAssert
static <ELEMENT> ProxyableIterableAssert<ELEMENT>
assumeThat
(Iterable<? extends ELEMENT> actual) Creates a new instance of
assumption.IterableAssert
static AbstractLongAssert<?>
assumeThat
(Long actual) Creates a new instance of
assumption.LongAssert
static AbstractShortAssert<?>
assumeThat
(Short actual) Creates a new instance of
assumption.ShortAssert
static AbstractStringAssert<?>
assumeThat
(String actual) Creates a new instance of
assumption.StringAssert
static AbstractCharSequenceAssert<?,
? extends CharSequence> assumeThat
(StringBuffer actual) Creates a new instance of
assumption from aCharSequenceAssert
StringBuffer
.static AbstractCharSequenceAssert<?,
? extends CharSequence> assumeThat
(StringBuilder actual) Creates a new instance of
assumption from aCharSequenceAssert
StringBuilder
.static AbstractThrowableAssert<?,
? extends Throwable> assumeThat
(Throwable actual) Creates a new instance of
assumption.ThrowableAssert
static AbstractBigDecimalAssert<?>
assumeThat
(BigDecimal actual) Creates a new instance of
assumption.BigDecimalAssert
static AbstractBigIntegerAssert<?>
assumeThat
(BigInteger actual) Creates a new instance of
assumption.BigIntegerAssert
static AbstractUriAssert<?>
assumeThat
(URI actual) Creates a new instance of
assumption.UriAssert
static AbstractUrlAssert<?>
assumeThat
(URL actual) Creates a new instance of
assumption.UrlAssert
static AbstractPathAssert<?>
assumeThat
(Path actual) Creates a new instance ofPathAssert
assumption.static AbstractDurationAssert<?>
assumeThat
(Duration actual) Creates a new instance ofDurationAssert
assumption.static AbstractInstantAssert<?>
assumeThat
(Instant actual) Creates a new instance ofInstantAssert
assumption.static AbstractLocalDateAssert<?>
assumeThat
(LocalDate actual) Creates a new instance ofLocalDateAssert
assumption.static AbstractLocalDateTimeAssert<?>
assumeThat
(LocalDateTime actual) Creates a new instance ofLocalDateTimeAssert
assumption.static AbstractLocalTimeAssert<?>
assumeThat
(LocalTime actual) Creates a new instance ofLocalTimeAssert
assumption.static AbstractOffsetDateTimeAssert<?>
assumeThat
(OffsetDateTime actual) Creates a new instance ofOffsetDateTimeAssert
assumption.static AbstractOffsetTimeAssert<?>
assumeThat
(OffsetTime actual) Creates a new instance ofOffsetTimeAssert
assumption.static AbstractPeriodAssert<?>
assumeThat
(Period actual) Creates a new instance ofPeriodAssert
assumption.static AbstractZonedDateTimeAssert<?>
assumeThat
(ZonedDateTime actual) Creates a new instance ofZonedDateTimeAssert
assumption.static AtomicBooleanAssert
assumeThat
(AtomicBoolean actual) Create assumption forAtomicBoolean
.static AtomicIntegerAssert
assumeThat
(AtomicInteger actual) Create assumption forAtomicInteger
.static AtomicIntegerArrayAssert
assumeThat
(AtomicIntegerArray actual) Creates int[] assumption forAtomicIntegerArray
.static <OBJECT> AtomicIntegerFieldUpdaterAssert<OBJECT>
assumeThat
(AtomicIntegerFieldUpdater<OBJECT> actual) Create assumption forAtomicIntegerFieldUpdater
.static AtomicLongAssert
assumeThat
(AtomicLong actual) Create assumption forAtomicLong
.static AtomicLongArrayAssert
assumeThat
(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 LongAdderAssert
assumeThat
(LongAdder actual) Create assumption forLongAdder
.static <RESULT> CompletableFutureAssert<RESULT>
assumeThat
(CompletableFuture<RESULT> actual) Creates a new instance ofCompletableFutureAssert
assumption.static <RESULT> CompletableFutureAssert<RESULT>
assumeThat
(CompletionStage<RESULT> actual) Creates a new instance ofCompletableFutureAssert
assumption for aCompletionStage
by converting it to aCompletableFuture
and returning aCompletableFutureAssert
.static <RESULT> AbstractFutureAssert<?,
? extends Future<? extends RESULT>, RESULT> assumeThat
(Future<RESULT> future) Create assertion forFutureAssert
assumption.static AbstractDateAssert<?>
assumeThat
(Date actual) Creates a new instance of
assumption.DateAssert
static DoublePredicateAssert
assumeThat
(DoublePredicate actual) Creates a new instance ofDoublePredicateAssert
assumption.static IntPredicateAssert
assumeThat
(IntPredicate actual) Creates a new instance ofIntPredicateAssert
assumption.static LongPredicateAssert
assumeThat
(LongPredicate actual) Creates a new instance ofLongPredicateAssert
assumption.static <T> ProxyablePredicateAssert<T>
assumeThat
(Predicate<T> actual) Creates a new instance ofPredicateAssert
assumption.static <ELEMENT> IteratorAssert<ELEMENT>
assumeThat
(Iterator<? extends ELEMENT> actual) Creates a new instance of
assumption.IteratorAssert
static <ELEMENT> FactoryBasedNavigableListAssert<ProxyableListAssert<ELEMENT>,
List<? extends ELEMENT>, ELEMENT, ObjectAssert<ELEMENT>> assumeThat
(List<? extends ELEMENT> actual) Creates a new instance of
assumption.ListAssert
static <K,
V> AbstractMapAssert<?, ?, K, V> assumeThat
(Map<K, V> actual) Creates a new instance of
assumption.MapAssert
static <VALUE> OptionalAssert<VALUE>
assumeThat
(Optional<VALUE> actual) Creates a new instance ofOptionalAssert
assumption.static OptionalDoubleAssert
assumeThat
(OptionalDouble actual) Creates a new instance ofOptionalDoubleAssert
assumption.static OptionalIntAssert
assumeThat
(OptionalInt actual) Creates a new instance ofOptionalIntAssert
assumption.static OptionalLongAssert
assumeThat
(OptionalLong actual) Creates a new instance ofOptionalLongAssert
assumption.static <ELEMENT> AbstractSpliteratorAssert<?,
ELEMENT> assumeThat
(Spliterator<ELEMENT> actual) Creates a new instance of
assumption from the givenSpliteratorAssert
Spliterator
.static AbstractListAssert<?,
List<? extends Double>, Double, ObjectAssert<Double>> assumeThat
(DoubleStream actual) Creates a new instance of
assumption from the givenListAssert
DoubleStream
.static AbstractListAssert<?,
List<? extends Integer>, Integer, ObjectAssert<Integer>> assumeThat
(IntStream actual) Creates a new instance of
assumption from the givenListAssert
IntStream
.static AbstractListAssert<?,
List<? extends Long>, Long, ObjectAssert<Long>> assumeThat
(LongStream actual) Creates a new instance of
assumption from the givenListAssert
LongStream
.static <ELEMENT> AbstractListAssert<?,
List<? extends ELEMENT>, ELEMENT, ObjectAssert<ELEMENT>> assumeThat
(Stream<? extends ELEMENT> actual) Creates a new instance of
assumption from the givenListAssert
Stream
.static <T> ProxyableObjectAssert<T>
assumeThat
(T actual) Creates a new instance of
assumption.ObjectAssert
static <T> ProxyableObjectArrayAssert<T>
assumeThat
(T[] actual) Creates a new instance of
assumption.ObjectArrayAssert
static <T> Object2DArrayAssert<T>
assumeThat
(T[][] actual) Creates a new instance of
assumption.Object2DArrayAssert
static AbstractThrowableAssert<?,
? extends Throwable> assumeThatCode
(ThrowableAssert.ThrowingCallable shouldRaiseOrNotThrowable) Allows to capture and then assume on aThrowable
(easier done with lambdas).static <T> ProxyableObjectAssert<T>
assumeThatObject
(T actual) Creates a new instance of
assumption.ObjectAssert
static AbstractThrowableAssert<?,
? extends Throwable> assumeThatThrownBy
(ThrowableAssert.ThrowingCallable shouldRaiseThrowable) Allows to capture and then assume on aThrowable
(easier done with lambdas).private static RuntimeException
assumptionNotMet
(AssertionError assertionError) private static RuntimeException
assumptionNotMet
(Class<?> exceptionClass, AssertionError e) private static <ASSERTION>
Class<? extends ASSERTION>createAssumptionClass
(Class<ASSERTION> assertClass) protected static <ASSERTION>
Class<? extends ASSERTION>generateAssumptionClass
(Class<ASSERTION> assertionType) private static Class<?>
getAssumptionClass
(String className)
-
Field Details
-
BYTE_BUDDY
private static final net.bytebuddy.ByteBuddy BYTE_BUDDYThis NamingStrategy takes the original class's name and adds a suffix to distinguish it. The default is ByteBuddy but for debugging purposes, it makes sense to add AssertJ as a name. -
ASSUMPTION
private static final net.bytebuddy.implementation.Implementation ASSUMPTION -
CACHE
private static final net.bytebuddy.TypeCache<net.bytebuddy.TypeCache.SimpleKey> CACHE
-
-
Constructor Details
-
Assumptions
public Assumptions()
-
-
Method Details
-
assumeThat
Creates a new instance of
assumption.ObjectAssert
- Type Parameters:
T
- the type of the actual value.- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.StringAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.BigDecimalAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.BigIntegerAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.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 of
assumption.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 of
assumption.BooleanAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.BooleanAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.BooleanArrayAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.Boolean2DArrayAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 3.17.0
-
assumeThat
Creates a new instance of
assumption.ByteAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.ByteAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.ByteArrayAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.Byte2DArrayAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 3.17.0
-
assumeThat
Creates a new instance of
assumption.CharacterAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.CharacterAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.CharArrayAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.Char2DArrayAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 3.17.0
-
assumeThat
Creates a new instance of
assumption.CharSequenceAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption from aCharSequenceAssert
StringBuilder
.- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 3.11.0
-
assumeThat
Creates a new instance of
assumption from aCharSequenceAssert
StringBuffer
.- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 3.11.0
-
assumeThat
Creates a new instance of
assumption.ShortAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.ShortAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.ShortArrayAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.Short2DArrayAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 3.17.0
-
assumeThat
Creates a new instance of
assumption.IntegerAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.IntegerAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.IntArrayAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.Int2DArrayAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 3.17.0
-
assumeThat
Creates a new instance of
assumption.LongAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.LongAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.LongArrayAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.Long2DArrayAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 3.17.0
-
assumeThat
Creates a new instance of
assumption.FloatAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.FloatAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.FloatArrayAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.Float2DArrayAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 3.17.0
-
assumeThat
Creates a new instance of
assumption.DoubleAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.DoubleAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.DoubleArrayAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.Double2DArrayAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 3.17.0
-
assumeThat
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 of
assumption.ClassAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.DateAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.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 ofPathAssert
assumption.- Parameters:
actual
- the path to test- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.InputStreamAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
public static <RESULT> AbstractFutureAssert<?,? extends Future<? extends RESULT>, assumeThatRESULT> (Future<RESULT> future) Create assertion forFutureAssert
assumption.- 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
public static <ELEMENT> ProxyableIterableAssert<ELEMENT> assumeThat(Iterable<? extends ELEMENT> actual) Creates a new instance of
assumption.IterableAssert
- Type Parameters:
ELEMENT
- the type of elements.- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.IteratorAssert
Breaking change in version 3.12.0: this method does not return anymore an
ProxyableIterableAssert
but anIteratorAssert
.- Type Parameters:
ELEMENT
- the type of elements.- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
public static <ELEMENT> FactoryBasedNavigableListAssert<ProxyableListAssert<ELEMENT>,List<? extends ELEMENT>, assumeThatELEMENT, ObjectAssert<ELEMENT>> (List<? extends ELEMENT> actual) Creates a new instance of
assumption.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
-
assumeThat
Creates a new instance of
assumption.ObjectArrayAssert
- Type Parameters:
T
- the type of elements.- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.Object2DArrayAssert
- Type Parameters:
T
- the type of elements.- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 3.17.0
-
assumeThat
Creates a new instance of
assumption.MapAssert
- Type Parameters:
K
- the type of keys in the map.V
- the type of values in the map.- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.GenericComparableAssert
- Type Parameters:
T
- the type of actual.- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThat
Creates a new instance of
assumption.ThrowableAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.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.ThrowingCallable
or lambda with the code that should raise the throwable.- Returns:
- the created assumption for assertion object.
- Since:
- 2.9.0 / 3.9.0
-
assumeThatCode
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
assumeThat
because the java compiler reported it ambiguous when used directly with a lambda :(- Parameters:
shouldRaiseOrNotThrowable
- TheThrowableAssert.ThrowingCallable
or lambda with the code that should raise the throwable.- Returns:
- the created
ThrowableAssert
. - Since:
- 3.9.0
-
assumeThatObject
Creates a new instance of
assumption.ObjectAssert
This overload is useful, when an overloaded method of assertThat(...) takes precedence over the generic
assumeThat(Object)
.Example:
Cast necessary because
assumeThat(List)
"forgets" actual type:
No cast needed, but also no additional list assertions:assumeThat(new LinkedList<>(asList("abc"))).matches(list -> ((Deque<String>) list).getFirst().equals("abc"));
assumeThatObject(new LinkedList<>(asList("abc"))).matches(list -> list.getFirst().equals("abc"));
- Type Parameters:
T
- the type of the actual value.- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
- Since:
- 3.12.0
-
assumeThat
Creates a new instance ofPredicateAssert
assumption.- Type Parameters:
T
- thePredicate
type.- Parameters:
actual
- the Predicate to test- Returns:
- the created assumption for assertion object.
- Since:
- 3.9.0
-
assumeThat
Creates a new instance ofIntPredicateAssert
assumption.- Parameters:
actual
- the IntPredicate to test- Returns:
- the created assumption for assertion object.
- Since:
- 3.9.0
-
assumeThat
Creates a new instance ofLongPredicateAssert
assumption.- Parameters:
actual
- the LongPredicate to test- Returns:
- the created assumption for assertion object.
- Since:
- 3.9.0
-
assumeThat
Creates a new instance ofDoublePredicateAssert
assumption.- Parameters:
actual
- the DoublePredicate to test- Returns:
- the created assumption for assertion object.
- Since:
- 3.9.0
-
assumeThat
Creates a new instance ofCompletableFutureAssert
assumption.- Type Parameters:
RESULT
- the CompletableFuture wrapped type.- Parameters:
actual
- the CompletableFuture to test- Returns:
- the created assumption for assertion object.
- Since:
- 3.9.0
-
assumeThat
Creates a new instance ofCompletableFutureAssert
assumption for aCompletionStage
by converting it to aCompletableFuture
and returning aCompletableFutureAssert
.If the given
CompletionStage
is null, theCompletableFuture
in the returnedCompletableFutureAssert
will also be null.- Type Parameters:
RESULT
- the CompletableFuture wrapped type.- Parameters:
actual
- the CompletableFuture to test- Returns:
- the created assumption for assertion object.
- Since:
- 3.9.0
-
assumeThat
Creates a new instance ofOptionalAssert
assumption.- Type Parameters:
VALUE
- the Optional wrapped type.- Parameters:
actual
- the Optional to test- Returns:
- the created assumption for assertion object.
- Since:
- 3.9.0
-
assumeThat
Creates a new instance ofOptionalDoubleAssert
assumption.- Parameters:
actual
- the OptionalDouble to test- Returns:
- the created assumption for assertion object.
- Since:
- 3.9.0
-
assumeThat
Creates a new instance ofOptionalIntAssert
assumption.- Parameters:
actual
- the OptionalInt to test- Returns:
- the created assumption for assertion object.
- Since:
- 3.9.0
-
assumeThat
Creates a new instance ofOptionalLongAssert
assumption.- Parameters:
actual
- the OptionalLong to test- Returns:
- the created assumption for assertion object.
- Since:
- 3.9.0
-
assumeThat
Creates a new instance ofZonedDateTimeAssert
assumption.- Parameters:
actual
- the ZonedDateTime to test- Returns:
- the created assumption for assertion object.
- Since:
- 3.9.0
-
assumeThat
Creates a new instance ofLocalDateTimeAssert
assumption.- Parameters:
actual
- the LocalDateTime to test- Returns:
- the created assumption for assertion object.
- Since:
- 3.9.0
-
assumeThat
Creates a new instance ofOffsetDateTimeAssert
assumption.- Parameters:
actual
- the OffsetDateTime to test- Returns:
- the created assumption for assertion object.
- Since:
- 3.9.0
-
assumeThat
Creates a new instance ofOffsetTimeAssert
assumption.- Parameters:
actual
- the LocalTime to test- Returns:
- the created assumption for assertion object.
- Since:
- 3.9.0
-
assumeThat
Creates a new instance ofLocalTimeAssert
assumption.- Parameters:
actual
- the LocalTime to test- Returns:
- the created assumption for assertion object.
- Since:
- 3.9.0
-
assumeThat
Creates a new instance ofLocalDateAssert
assumption.- Parameters:
actual
- the LocalDate to test- Returns:
- the created assumption for assertion object.
- Since:
- 3.9.0
-
assumeThat
Creates a new instance ofInstantAssert
assumption.- Parameters:
actual
- the Instant to test- Returns:
- the created assumption for assertion object.
- Since:
- 3.9.0
-
assumeThat
Creates a new instance ofDurationAssert
assumption.- Parameters:
actual
- the Duration to test- Returns:
- the created assumption for assertion object.
- Since:
- 3.15.0
-
assumeThat
Creates a new instance ofPeriodAssert
assumption.- 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 of
assumption from the givenListAssert
Stream
.- Type Parameters:
ELEMENT
- the type of elements.- Parameters:
actual
- the Stream to test- Returns:
- the created assumption for assertion object.
- Since:
- 3.9.0
-
assumeThat
public static AbstractListAssert<?,List<? extends Double>, assumeThatDouble, ObjectAssert<Double>> (DoubleStream actual) Creates a new instance of
assumption from the givenListAssert
DoubleStream
.- 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 of
assumption from the givenListAssert
LongStream
.- 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 of
assumption from the givenListAssert
IntStream
.- 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 of
assumption from the givenSpliteratorAssert
Spliterator
.- Type Parameters:
ELEMENT
- the type of the elements- Parameters:
actual
- the Spliterator to test- Returns:
- the created assumption for assertion object.
-
asAssumption
-
asAssumption
-
createAssumptionClass
-
generateAssumptionClass
-
assumptionNotMet
private static RuntimeException assumptionNotMet(AssertionError assertionError) throws ReflectiveOperationException - Throws:
ReflectiveOperationException
-
getAssumptionClass
-
assumptionNotMet
private static RuntimeException assumptionNotMet(Class<?> exceptionClass, AssertionError e) throws ReflectiveOperationException - Throws:
ReflectiveOperationException
-
asAssumption
-
asRecursiveComparisonAssumption
-
asMapSizeAssumption
-
asIterableSizeAssumption
-