Interface Java6StandardSoftAssertionsProvider
-
- All Superinterfaces:
AfterAssertionErrorCollected,AssertionErrorCollector,SoftAssertionsProvider
- All Known Subinterfaces:
StandardSoftAssertionsProvider
- All Known Implementing Classes:
AutoCloseableSoftAssertions,Java6JUnitSoftAssertions,Java6SoftAssertions,JUnitJupiterSoftAssertions,JUnitSoftAssertions,SoftAssertions
public interface Java6StandardSoftAssertionsProvider extends SoftAssertionsProvider
AbstractStandardSoftAssertions compatible with Android. Duplicated fromStandardSoftAssertionsProvider.- Since:
- 2.5.0 / 3.5.0
- See Also:
StandardSoftAssertionsProvider
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.assertj.core.api.SoftAssertionsProvider
SoftAssertionsProvider.ThrowingRunnable
-
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default BooleanAssertassertThat(boolean actual)Creates a new instance of.BooleanAssertdefault BooleanArrayAssertassertThat(boolean[] actual)Creates a new instance of.BooleanArrayAssertdefault Boolean2DArrayAssertassertThat(boolean[][] actual)Creates a new instance of.Boolean2DArrayAssertdefault ByteAssertassertThat(byte actual)Creates a new instance of.ByteAssertdefault ByteArrayAssertassertThat(byte[] actual)Creates a new instance of.ByteArrayAssertdefault Byte2DArrayAssertassertThat(byte[][] actual)Creates a new instance of.Byte2DArrayAssertdefault CharacterAssertassertThat(char actual)Creates a new instance of.CharacterAssertdefault CharArrayAssertassertThat(char[] actual)Creates a new instance of.CharArrayAssertdefault Char2DArrayAssertassertThat(char[][] actual)Creates a new instance of.Char2DArrayAssertdefault DoubleAssertassertThat(double actual)Creates a new instance of.DoubleAssertdefault DoubleArrayAssertassertThat(double[] actual)Creates a new instance of.DoubleArrayAssertdefault Double2DArrayAssertassertThat(double[][] actual)Creates a new instance of.Double2DArrayAssertdefault FloatAssertassertThat(float actual)Creates a new instance of.FloatAssertdefault FloatArrayAssertassertThat(float[] actual)Creates a new instance of.FloatArrayAssertdefault Float2DArrayAssertassertThat(float[][] actual)Creates a new instance of.Float2DArrayAssertdefault IntegerAssertassertThat(int actual)Creates a new instance of.IntegerAssertdefault IntArrayAssertassertThat(int[] actual)Creates a new instance of.IntArrayAssertdefault Int2DArrayAssertassertThat(int[][] actual)Creates a new instance of.Int2DArrayAssertdefault LongAssertassertThat(long actual)Creates a new instance of.LongAssertdefault LongArrayAssertassertThat(long[] actual)Creates a new instance of.LongArrayAssertdefault Long2DArrayAssertassertThat(long[][] actual)Creates a new instance of.Long2DArrayAssertdefault ShortAssertassertThat(short actual)Creates a new instance of.ShortAssertdefault ShortArrayAssertassertThat(short[] actual)Creates a new instance of.ShortArrayAssertdefault Short2DArrayAssertassertThat(short[][] actual)Creates a new instance of.Short2DArrayAssertdefault FileAssertassertThat(java.io.File actual)Creates a new instance of.FileAssertdefault InputStreamAssertassertThat(java.io.InputStream actual)Creates a new instance of.InputStreamAssertdefault BooleanAssertassertThat(java.lang.Boolean actual)Creates a new instance of.BooleanAssertdefault ByteAssertassertThat(java.lang.Byte actual)Creates a new instance of.ByteAssertdefault CharacterAssertassertThat(java.lang.Character actual)Creates a new instance of.CharacterAssertdefault CharSequenceAssertassertThat(java.lang.CharSequence actual)Creates a new instance of.CharSequenceAssertdefault ClassAssertassertThat(java.lang.Class<?> actual)Creates a new instance ofClassAssertdefault DoubleAssertassertThat(java.lang.Double actual)Creates a new instance of.DoubleAssertdefault FloatAssertassertThat(java.lang.Float actual)Creates a new instance of.FloatAssertdefault IntegerAssertassertThat(java.lang.Integer actual)Creates a new instance of.IntegerAssertdefault <T> IterableAssert<T>assertThat(java.lang.Iterable<? extends T> actual)Creates a new instance of.IterableAssertdefault LongAssertassertThat(java.lang.Long actual)Creates a new instance of.LongAssertdefault ShortAssertassertThat(java.lang.Short actual)Creates a new instance of.ShortAssertdefault StringAssertassertThat(java.lang.String actual)Creates a new instance of.StringAssertdefault CharSequenceAssertassertThat(java.lang.StringBuffer actual)Creates a new instance offrom aCharSequenceAssertStringBuffer.default CharSequenceAssertassertThat(java.lang.StringBuilder actual)Creates a new instance offrom aCharSequenceAssertStringBuilder.default BigDecimalAssertassertThat(java.math.BigDecimal actual)Creates a new instance of.BigDecimalAssertdefault BigIntegerAssertassertThat(java.math.BigInteger actual)Creates a new instance of.BigIntegerdefault UriAssertassertThat(java.net.URI actual)Creates a new instance of.UriAssertdefault AbstractUrlAssert<?>assertThat(java.net.URL actual)Creates a new instance of.UrlAssertdefault <T> CollectionAssert<T>assertThat(java.util.Collection<? extends T> actual)Creates a new instance of.CollectionAssertdefault AtomicBooleanAssertassertThat(java.util.concurrent.atomic.AtomicBoolean actual)Create assertion forAtomicBoolean.default AtomicIntegerAssertassertThat(java.util.concurrent.atomic.AtomicInteger actual)Create assertion forAtomicInteger.default AtomicIntegerArrayAssertassertThat(java.util.concurrent.atomic.AtomicIntegerArray actual)Create assertion forAtomicIntegerArray.default <OBJECT> AtomicIntegerFieldUpdaterAssert<OBJECT>assertThat(java.util.concurrent.atomic.AtomicIntegerFieldUpdater<OBJECT> actual)Create assertion forAtomicIntegerFieldUpdater.default AtomicLongAssertassertThat(java.util.concurrent.atomic.AtomicLong actual)Create assertion forAtomicLong.default AtomicLongArrayAssertassertThat(java.util.concurrent.atomic.AtomicLongArray actual)Create assertion forAtomicLongArray.default <OBJECT> AtomicLongFieldUpdaterAssert<OBJECT>assertThat(java.util.concurrent.atomic.AtomicLongFieldUpdater<OBJECT> actual)Create assertion forAtomicLongFieldUpdater.default <VALUE> AtomicMarkableReferenceAssert<VALUE>assertThat(java.util.concurrent.atomic.AtomicMarkableReference<VALUE> actual)Create assertion forAtomicMarkableReference.default <VALUE> AtomicReferenceAssert<VALUE>assertThat(java.util.concurrent.atomic.AtomicReference<VALUE> actual)Create assertion forAtomicReference.default <ELEMENT> AtomicReferenceArrayAssert<ELEMENT>assertThat(java.util.concurrent.atomic.AtomicReferenceArray<ELEMENT> actual)Create assertion forAtomicReferenceArray.default <FIELD,OBJECT>
AtomicReferenceFieldUpdaterAssert<FIELD,OBJECT>assertThat(java.util.concurrent.atomic.AtomicReferenceFieldUpdater<OBJECT,FIELD> actual)Create assertion forAtomicReferenceFieldUpdater.default <VALUE> AtomicStampedReferenceAssert<VALUE>assertThat(java.util.concurrent.atomic.AtomicStampedReference<VALUE> actual)Create assertion forAtomicStampedReference.default <RESULT> FutureAssert<RESULT>assertThat(java.util.concurrent.Future<RESULT> actual)Creates a new instance of.FutureAssertdefault DateAssertassertThat(java.util.Date actual)Creates a new instance of.DateAssertdefault <T> IteratorAssert<T>assertThat(java.util.Iterator<? extends T> actual)Creates a new instance of.IteratorAssertdefault <T> ListAssert<T>assertThat(java.util.List<? extends T> actual)Creates a new instance of.ListAssertdefault <K,V>
MapAssert<K,V>assertThat(java.util.Map<K,V> actual)Creates a new instance of.MapAssertdefault <T extends java.lang.Comparable<? super T>>
AbstractComparableAssert<?,T>assertThat(T actual)Creates a new instance ofwith standard comparison semantics.GenericComparableAssertdefault <T> ObjectArrayAssert<T>assertThat(T[] actual)Creates a new instance of.ObjectArrayAssertdefault <T> Object2DArrayAssert<T>assertThat(T[][] actual)Creates a new instance of.Object2DArrayAssertdefault CharSequenceAssertassertThatCharSequence(java.lang.CharSequence actual)Creates a new instance of.CharSequenceAssertdefault AbstractThrowableAssert<?,? extends java.lang.Throwable>assertThatCode(ThrowableAssert.ThrowingCallable shouldRaiseOrNotThrowable)Allows to capture and then assert on aThrowablemore easily when used with Java 8 lambdas.default <T> CollectionAssert<T>assertThatCollection(java.util.Collection<? extends T> actual)Creates a new instance of.CollectionAssertdefault <T> AbstractUniversalComparableAssert<?,T>assertThatComparable(java.lang.Comparable<T> actual)Creates a new instance ofwith standard comparison semantics.UniversalComparableAssertdefault ThrowableTypeAssert<java.lang.Exception>assertThatException()Alias forassertThatExceptionOfType(Class)forException.default <T extends java.lang.Throwable>
ThrowableTypeAssert<T>assertThatExceptionOfType(java.lang.Class<T> throwableType)Entry point to check that an exception of type T is thrown by a giventhrowingCallablewhich allows to chain assertions on the thrown exception.default ThrowableTypeAssert<java.lang.IllegalArgumentException>assertThatIllegalArgumentException()Alias forassertThatExceptionOfType(Class)forIllegalArgumentException.default ThrowableTypeAssert<java.lang.IllegalStateException>assertThatIllegalStateException()Alias forassertThatExceptionOfType(Class)forIllegalStateException.default ThrowableTypeAssert<java.lang.IndexOutOfBoundsException>assertThatIndexOutOfBoundsException()Alias forassertThatExceptionOfType(Class)forIndexOutOfBoundsException.default ThrowableTypeAssert<java.io.IOException>assertThatIOException()Alias forassertThatExceptionOfType(Class)forIOException.default <ELEMENT> IterableAssert<ELEMENT>assertThatIterable(java.lang.Iterable<? extends ELEMENT> actual)Creates a new instance of.IterableAssertdefault <ELEMENT> IteratorAssert<ELEMENT>assertThatIterator(java.util.Iterator<? extends ELEMENT> actual)Creates a new instance of.IteratorAssertdefault <ELEMENT> ListAssert<ELEMENT>assertThatList(java.util.List<? extends ELEMENT> actual)Creates a new instance of.ListAssertdefault ThrowableTypeAssert<java.lang.NullPointerException>assertThatNullPointerException()Alias forassertThatExceptionOfType(Class)forNullPointerException.default <T> ObjectAssert<T>assertThatObject(T actual)Creates a new instance offor any object.ObjectAssertdefault ThrowableTypeAssert<java.lang.ReflectiveOperationException>assertThatReflectiveOperationException()Alias forassertThatExceptionOfType(Class)forReflectiveOperationException.default ThrowableTypeAssert<java.lang.RuntimeException>assertThatRuntimeException()Alias forassertThatExceptionOfType(Class)forRuntimeException.default AbstractThrowableAssert<?,? extends java.lang.Throwable>assertThatThrownBy(ThrowableAssert.ThrowingCallable shouldRaiseThrowable)Allows to capture and then assert on aThrowablemore easily when used with Java 8 lambdas.default AbstractThrowableAssert<?,? extends java.lang.Throwable>assertThatThrownBy(ThrowableAssert.ThrowingCallable shouldRaiseThrowable, java.lang.String description, java.lang.Object... args)Allows to capture and then assert on aThrowablelikeassertThatThrownBy(ThrowingCallable)but this method let you set the assertion description the same way you do withas(String, Object...).-
Methods inherited from interface org.assertj.core.api.AssertionErrorCollector
assertionErrorsCollected, collectAssertionError, getDelegate, onAssertionErrorCollected, setDelegate, succeeded, wasSuccess
-
Methods inherited from interface org.assertj.core.api.SoftAssertionsProvider
assertAll, assertAlso, check, proxy
-
-
-
-
Method Detail
-
assertThat
default BigDecimalAssert assertThat(java.math.BigDecimal actual)
Creates a new instance of.BigDecimalAssert- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
-
assertThat
default BigIntegerAssert assertThat(java.math.BigInteger actual)
Creates a new instance of.BigInteger- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
- Since:
- 2.7.0 / 3.7.0
-
assertThat
default BooleanAssert assertThat(boolean actual)
Creates a new instance of.BooleanAssert- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
-
assertThat
default BooleanAssert assertThat(java.lang.Boolean actual)
Creates a new instance of.BooleanAssert- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
-
assertThat
default BooleanArrayAssert assertThat(boolean[] actual)
Creates a new instance of.BooleanArrayAssert- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
-
assertThat
default Boolean2DArrayAssert assertThat(boolean[][] actual)
Creates a new instance of.Boolean2DArrayAssert- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
- Since:
- 3.17.0
-
assertThat
default ByteAssert assertThat(byte actual)
Creates a new instance of.ByteAssert- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
-
assertThat
default ByteAssert assertThat(java.lang.Byte actual)
Creates a new instance of.ByteAssert- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
-
assertThat
default ByteArrayAssert assertThat(byte[] actual)
Creates a new instance of.ByteArrayAssert- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
-
assertThat
default Byte2DArrayAssert assertThat(byte[][] actual)
Creates a new instance of.Byte2DArrayAssert- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
- Since:
- 3.17.0
-
assertThat
default CharacterAssert assertThat(char actual)
Creates a new instance of.CharacterAssert- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
-
assertThat
default CharArrayAssert assertThat(char[] actual)
Creates a new instance of.CharArrayAssert- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
-
assertThat
default Char2DArrayAssert assertThat(char[][] actual)
Creates a new instance of.Char2DArrayAssert- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
- Since:
- 3.17.0
-
assertThat
default CharacterAssert assertThat(java.lang.Character actual)
Creates a new instance of.CharacterAssert- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
-
assertThat
default ClassAssert assertThat(java.lang.Class<?> actual)
Creates a new instance ofClassAssert- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
-
assertThat
default <T> CollectionAssert<T> assertThat(java.util.Collection<? extends T> actual)
Creates a new instance of.CollectionAssert- Type Parameters:
T- the actual element's type.- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
- Since:
- 3.21.0
-
assertThatCollection
default <T> CollectionAssert<T> assertThatCollection(java.util.Collection<? extends T> actual)
Creates a new instance of.CollectionAssertUse this over
assertThat(Collection)in case of ambiguous method resolution when the object under test implements several interfaces Assertj providesassertThatfor.- Type Parameters:
T- the type of elements.- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
- Since:
- 3.23.0
-
assertThat
default <T extends java.lang.Comparable<? super T>> AbstractComparableAssert<?,T> assertThat(T actual)
Creates a new instance ofwith standard comparison semantics.GenericComparableAssert- Type Parameters:
T- the actual type.- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
-
assertThatComparable
default <T> AbstractUniversalComparableAssert<?,T> assertThatComparable(java.lang.Comparable<T> actual)
Creates a new instance ofwith standard comparison semantics.UniversalComparableAssertUse this over
assertThat(Comparable)in case of ambiguous method resolution when the object under test implements several interfaces Assertj providesassertThatfor.- Type Parameters:
T- the type of actual.- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
- Since:
- 3.23.0
-
assertThat
default <T> IterableAssert<T> assertThat(java.lang.Iterable<? extends T> actual)
Creates a new instance of.IterableAssert- Type Parameters:
T- the actual element's type.- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
-
assertThatIterable
default <ELEMENT> IterableAssert<ELEMENT> assertThatIterable(java.lang.Iterable<? extends ELEMENT> actual)
Creates a new instance of.IterableAssertUse this over
assertThat(Iterable)in case of ambiguous method resolution when the object under test implements several interfaces Assertj providesassertThatfor.- Type Parameters:
ELEMENT- the type of elements.- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
- Since:
- 3.23.0
-
assertThat
default <T> IteratorAssert<T> assertThat(java.util.Iterator<? extends T> actual)
Creates a new instance of.IteratorAssertThis is a breaking change in version 3.12.0: this method used to return an
IterableAssert.- Type Parameters:
T- the actual element's type.- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
-
assertThatIterator
default <ELEMENT> IteratorAssert<ELEMENT> assertThatIterator(java.util.Iterator<? extends ELEMENT> actual)
Creates a new instance of.IteratorAssertUse this over
assertThat(Iterator)in case of ambiguous method resolution when the object under test implements several interfaces Assertj providesassertThatfor.- Type Parameters:
ELEMENT- the type of elements.- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
- Since:
- 3.23.0
-
assertThat
default DoubleAssert assertThat(double actual)
Creates a new instance of.DoubleAssert- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
-
assertThat
default DoubleAssert assertThat(java.lang.Double actual)
Creates a new instance of.DoubleAssert- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
-
assertThat
default DoubleArrayAssert assertThat(double[] actual)
Creates a new instance of.DoubleArrayAssert- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
-
assertThat
default Double2DArrayAssert assertThat(double[][] actual)
Creates a new instance of.Double2DArrayAssert- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
- Since:
- 3.17.0
-
assertThat
default FileAssert assertThat(java.io.File actual)
Creates a new instance of.FileAssert- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
-
assertThat
default <RESULT> FutureAssert<RESULT> assertThat(java.util.concurrent.Future<RESULT> actual)
Creates a new instance of.FutureAssert- Type Parameters:
RESULT- theFutureelement type.- Parameters:
actual- the actual value- Returns:
- the created assertion object
-
assertThat
default InputStreamAssert assertThat(java.io.InputStream actual)
Creates a new instance of.InputStreamAssert- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
-
assertThat
default FloatAssert assertThat(float actual)
Creates a new instance of.FloatAssert- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
-
assertThat
default FloatAssert assertThat(java.lang.Float actual)
Creates a new instance of.FloatAssert- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
-
assertThat
default FloatArrayAssert assertThat(float[] actual)
Creates a new instance of.FloatArrayAssert- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
-
assertThat
default Float2DArrayAssert assertThat(float[][] actual)
Creates a new instance of.Float2DArrayAssert- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
- Since:
- 3.17.0
-
assertThat
default IntegerAssert assertThat(int actual)
Creates a new instance of.IntegerAssert- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
-
assertThat
default IntArrayAssert assertThat(int[] actual)
Creates a new instance of.IntArrayAssert- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
-
assertThat
default Int2DArrayAssert assertThat(int[][] actual)
Creates a new instance of.Int2DArrayAssert- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
- Since:
- 3.17.0
-
assertThat
default IntegerAssert assertThat(java.lang.Integer actual)
Creates a new instance of.IntegerAssert- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
-
assertThat
default <T> ListAssert<T> assertThat(java.util.List<? extends T> actual)
Creates a new instance of.ListAssert- Type Parameters:
T- the actual element's type.- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
-
assertThatList
default <ELEMENT> ListAssert<ELEMENT> assertThatList(java.util.List<? extends ELEMENT> actual)
Creates a new instance of.ListAssertUse this over
assertThat(List)in case of ambiguous method resolution when the object under test implements several interfaces Assertj providesassertThatfor.- Type Parameters:
ELEMENT- the type of elements.- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
- Since:
- 3.23.0
-
assertThat
default LongAssert assertThat(long actual)
Creates a new instance of.LongAssert- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
-
assertThat
default LongAssert assertThat(java.lang.Long actual)
Creates a new instance of.LongAssert- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
-
assertThat
default LongArrayAssert assertThat(long[] actual)
Creates a new instance of.LongArrayAssert- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
-
assertThat
default Long2DArrayAssert assertThat(long[][] actual)
Creates a new instance of.Long2DArrayAssert- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
- Since:
- 3.17.0
-
assertThat
default <T> ObjectAssert<T> assertThat(T actual)
Creates a new instance of.ObjectAssert- Type Parameters:
T- the type of the actual value.- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
-
assertThat
default <T> ObjectArrayAssert<T> assertThat(T[] actual)
Creates a new instance of.ObjectArrayAssert- Type Parameters:
T- the type values of the actual array.- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
-
assertThat
default <T> Object2DArrayAssert<T> assertThat(T[][] actual)
Creates a new instance of.Object2DArrayAssert- Type Parameters:
T- the type values of the actual array.- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
- Since:
- 3.17.0
-
assertThat
default <K,V> MapAssert<K,V> assertThat(java.util.Map<K,V> actual)
Creates a new instance of.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 assertion object.
-
assertThat
default ShortAssert assertThat(short actual)
Creates a new instance of.ShortAssert- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
-
assertThat
default ShortAssert assertThat(java.lang.Short actual)
Creates a new instance of.ShortAssert- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
-
assertThat
default ShortArrayAssert assertThat(short[] actual)
Creates a new instance of.ShortArrayAssert- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
-
assertThat
default Short2DArrayAssert assertThat(short[][] actual)
Creates a new instance of.Short2DArrayAssert- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
- Since:
- 3.17.0
-
assertThat
default CharSequenceAssert assertThat(java.lang.CharSequence actual)
Creates a new instance of.CharSequenceAssert- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
-
assertThatCharSequence
default CharSequenceAssert assertThatCharSequence(java.lang.CharSequence actual)
Creates a new instance of.CharSequenceAssertUse this over
assertThat(CharSequence)in case of ambiguous method resolution when the object under test implements several interfaces Assertj providesassertThatfor.- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
- Since:
- 3.25.0
-
assertThat
default CharSequenceAssert assertThat(java.lang.StringBuilder actual)
Creates a new instance offrom aCharSequenceAssertStringBuilder.- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
- Since:
- 3.11.0
-
assertThat
default CharSequenceAssert assertThat(java.lang.StringBuffer actual)
Creates a new instance offrom aCharSequenceAssertStringBuffer.- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
- Since:
- 3.11.0
-
assertThat
default StringAssert assertThat(java.lang.String actual)
Creates a new instance of.StringAssert- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
-
assertThat
default DateAssert assertThat(java.util.Date actual)
Creates a new instance of.DateAssert- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
-
assertThat
default AtomicBooleanAssert assertThat(java.util.concurrent.atomic.AtomicBoolean actual)
Create assertion forAtomicBoolean.- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
-
assertThat
default AtomicIntegerAssert assertThat(java.util.concurrent.atomic.AtomicInteger actual)
Create assertion forAtomicInteger.- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
-
assertThat
default AtomicIntegerArrayAssert assertThat(java.util.concurrent.atomic.AtomicIntegerArray actual)
Create assertion forAtomicIntegerArray.- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
-
assertThat
default <OBJECT> AtomicIntegerFieldUpdaterAssert<OBJECT> assertThat(java.util.concurrent.atomic.AtomicIntegerFieldUpdater<OBJECT> actual)
Create assertion forAtomicIntegerFieldUpdater.- Type Parameters:
OBJECT- the type of the object holding the updatable field.- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
-
assertThat
default AtomicLongAssert assertThat(java.util.concurrent.atomic.AtomicLong actual)
Create assertion forAtomicLong.- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
-
assertThat
default AtomicLongArrayAssert assertThat(java.util.concurrent.atomic.AtomicLongArray actual)
Create assertion forAtomicLongArray.- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
-
assertThat
default <OBJECT> AtomicLongFieldUpdaterAssert<OBJECT> assertThat(java.util.concurrent.atomic.AtomicLongFieldUpdater<OBJECT> actual)
Create assertion forAtomicLongFieldUpdater.- Type Parameters:
OBJECT- the type of the object holding the updatable field.- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
-
assertThat
default <VALUE> AtomicReferenceAssert<VALUE> assertThat(java.util.concurrent.atomic.AtomicReference<VALUE> actual)
Create assertion forAtomicReference.- Type Parameters:
VALUE- the type of object referred to by theAtomicReference.- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
-
assertThat
default <ELEMENT> AtomicReferenceArrayAssert<ELEMENT> assertThat(java.util.concurrent.atomic.AtomicReferenceArray<ELEMENT> actual)
Create assertion forAtomicReferenceArray.- Type Parameters:
ELEMENT- the type of object referred to by theAtomicReferenceArray.- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
-
assertThat
default <FIELD,OBJECT> AtomicReferenceFieldUpdaterAssert<FIELD,OBJECT> assertThat(java.util.concurrent.atomic.AtomicReferenceFieldUpdater<OBJECT,FIELD> actual)
Create assertion 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 assertion object.
-
assertThat
default <VALUE> AtomicMarkableReferenceAssert<VALUE> assertThat(java.util.concurrent.atomic.AtomicMarkableReference<VALUE> actual)
Create assertion forAtomicMarkableReference.- Type Parameters:
VALUE- The type of object referred to by this reference- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
-
assertThat
default <VALUE> AtomicStampedReferenceAssert<VALUE> assertThat(java.util.concurrent.atomic.AtomicStampedReference<VALUE> actual)
Create assertion forAtomicStampedReference.- Type Parameters:
VALUE- The type of object referred to by this reference- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
-
assertThat
default <T extends java.lang.Throwable> ThrowableAssert<T> assertThat(T actual)
Creates a new instance of.ThrowableAssert- Type Parameters:
T- the type of the actual throwable.- Parameters:
actual- the actual value.- Returns:
- the created assertion Throwable.
-
assertThatThrownBy
default AbstractThrowableAssert<?,? extends java.lang.Throwable> assertThatThrownBy(ThrowableAssert.ThrowingCallable shouldRaiseThrowable)
Allows to capture and then assert on aThrowablemore easily when used with Java 8 lambdas. Java 8 example :
Java 7 example :@Test default void testException() { SoftAssertions softly = new SoftAssertions(); softly.assertThatThrownBy(() -> { throw new Exception("boom!"); }).isInstanceOf(Exception.class) .hasMessageContaining("boom"); }SoftAssertions softly = new SoftAssertions(); softly.assertThatThrownBy(new ThrowingCallable() { @Override default Void call() throws Exception { throw new Exception("boom!"); } }).isInstanceOf(Exception.class) .hasMessageContaining("boom");- Parameters:
shouldRaiseThrowable- TheThrowableAssert.ThrowingCallableor lambda with the code that should raise the throwable.- Returns:
- The captured exception or
nullif none was raised by the callable.
-
assertThatThrownBy
default AbstractThrowableAssert<?,? extends java.lang.Throwable> assertThatThrownBy(ThrowableAssert.ThrowingCallable shouldRaiseThrowable, java.lang.String description, java.lang.Object... args)
Allows to capture and then assert on aThrowablelikeassertThatThrownBy(ThrowingCallable)but this method let you set the assertion description the same way you do withas(String, Object...).Example:
If the provided@Test default void testException() { SoftAssertions softly = new SoftAssertions(); // if this assertion failed (but it doesn't), the error message would start with [Test explosive code] softly.assertThatThrownBy(() -> { throw new IOException("boom!") }, "Test explosive code") .isInstanceOf(IOException.class) .hasMessageContaining("boom"); }ThrowingCallabledoes not raise an exception, an error is immediately thrown.The test description provided is honored but not the one with
as(String, Object...), example:// assertion will fail but "display me" won't appear in the error message softly.assertThatThrownBy(() -> {}).as("display me") .isInstanceOf(Exception.class); // assertion will fail AND "display me" will appear in the error message softly.assertThatThrownBy(() -> {}, "display me") .isInstanceOf(Exception.class);- Parameters:
shouldRaiseThrowable- TheThrowableAssert.ThrowingCallableor lambda with the code that should raise the throwable.description- the new description to set.args- optional parameter if description is a format String.- Returns:
- the created
ThrowableAssert. - Since:
- 3.9.0
-
assertThatCode
default AbstractThrowableAssert<?,? extends java.lang.Throwable> assertThatCode(ThrowableAssert.ThrowingCallable shouldRaiseOrNotThrowable)
Allows to capture and then assert on aThrowablemore easily when used with Java 8 lambdas.Example :
If the providedThrowingCallable callable = () -> { throw new Exception("boom!"); }; // assertion succeeds assertThatCode(callable).isInstanceOf(Exception.class) .hasMessageContaining("boom"); // assertion fails assertThatCode(callable).doesNotThrowAnyException();ThrowableAssert.ThrowingCallabledoes not validate against next assertions, an error is immediately raised, in that case the test description provided withas(String, Object...)is not honored.
To use a test description, useassertThatCode(ThrowableAssert.ThrowingCallable)as shown below.ThrowingCallable doNothing = () -> { // do nothing }; // assertion fails and "display me" appears in the assertion error assertThatCode(doNothing).as("display me") .isInstanceOf(Exception.class); // assertion will fail AND "display me" will appear in the error Throwable thrown = catchThrowable(doNothing); assertThatCode(thrown).as("display me") .isInstanceOf(Exception.class);This method was not named
assertThatbecause 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 captured exception or
nullif none was raised by the callable. - Since:
- 3.7.0
-
assertThatObject
default <T> ObjectAssert<T> assertThatObject(T actual)
Creates a new instance offor any object.ObjectAssertThis overload is useful, when an overloaded method of assertThat(...) takes precedence over the generic
assertThat(Object).Example:
Cast necessary becauseassertThat(List)"forgets" actual type:
No cast needed, but also no additional list assertions:assertThat(new LinkedList<>(asList("abc"))).matches(list -> ((Deque<String>) list).getFirst().equals("abc"));assertThatObject(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
-
assertThat
default UriAssert assertThat(java.net.URI actual)
Creates a new instance of.UriAssert- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
-
assertThat
default AbstractUrlAssert<?> assertThat(java.net.URL actual)
Creates a new instance of.UrlAssert- Parameters:
actual- the actual value.- Returns:
- the created assertion object.
-
assertThatExceptionOfType
default <T extends java.lang.Throwable> ThrowableTypeAssert<T> assertThatExceptionOfType(java.lang.Class<T> throwableType)
Entry point to check that an exception of type T is thrown by a giventhrowingCallablewhich allows to chain assertions on the thrown exception.Example:
This method is more or less the same ofsoftly.assertThatExceptionOfType(IOException.class) .isThrownBy(() -> { throw new IOException("boom!"); }) .withMessage("boom!");assertThatThrownBy(ThrowingCallable)but in a more natural way.- Type Parameters:
T- the Throwable type.- Parameters:
throwableType- the Throwable type class.- Returns:
- the created
ThrowableTypeAssert. - Since:
- 3.23.0.
-
assertThatRuntimeException
default ThrowableTypeAssert<java.lang.RuntimeException> assertThatRuntimeException()
Alias forassertThatExceptionOfType(Class)forRuntimeException.- Returns:
- the created
ThrowableTypeAssert. - Since:
- 3.23.0
-
assertThatNullPointerException
default ThrowableTypeAssert<java.lang.NullPointerException> assertThatNullPointerException()
Alias forassertThatExceptionOfType(Class)forNullPointerException.- Returns:
- the created
ThrowableTypeAssert. - Since:
- 3.23.0
-
assertThatIllegalArgumentException
default ThrowableTypeAssert<java.lang.IllegalArgumentException> assertThatIllegalArgumentException()
Alias forassertThatExceptionOfType(Class)forIllegalArgumentException.- Returns:
- the created
ThrowableTypeAssert. - Since:
- 3.23.0
-
assertThatIOException
default ThrowableTypeAssert<java.io.IOException> assertThatIOException()
Alias forassertThatExceptionOfType(Class)forIOException.- Returns:
- the created
ThrowableTypeAssert. - Since:
- 3.23.0
-
assertThatIllegalStateException
default ThrowableTypeAssert<java.lang.IllegalStateException> assertThatIllegalStateException()
Alias forassertThatExceptionOfType(Class)forIllegalStateException.- Returns:
- the created
ThrowableTypeAssert. - Since:
- 3.23.0
-
assertThatException
default ThrowableTypeAssert<java.lang.Exception> assertThatException()
Alias forassertThatExceptionOfType(Class)forException.- Returns:
- the created
ThrowableTypeAssert. - Since:
- 3.23.0
-
assertThatReflectiveOperationException
default ThrowableTypeAssert<java.lang.ReflectiveOperationException> assertThatReflectiveOperationException()
Alias forassertThatExceptionOfType(Class)forReflectiveOperationException.- Returns:
- the created
ThrowableTypeAssert. - Since:
- 3.23.0
-
assertThatIndexOutOfBoundsException
default ThrowableTypeAssert<java.lang.IndexOutOfBoundsException> assertThatIndexOutOfBoundsException()
Alias forassertThatExceptionOfType(Class)forIndexOutOfBoundsException.- Returns:
- the created
ThrowableTypeAssert. - Since:
- 3.23.0
-
-