Package org.assertj.core.api
Class Java6AbstractStandardSoftAssertions
java.lang.Object
org.assertj.core.api.AbstractSoftAssertions
org.assertj.core.api.Java6AbstractStandardSoftAssertions
- Direct Known Subclasses:
AbstractStandardSoftAssertions
,Java6JUnitSoftAssertions
,Java6SoftAssertions
AbstractStandardSoftAssertions compatible with Android. Duplicated from
AbstractStandardSoftAssertions
.- Since:
- 2.5.0 / 3.5.0
- See Also:
-
Field Summary
Fields inherited from class org.assertj.core.api.AbstractSoftAssertions
proxies
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionassertThat
(boolean actual) Creates a new instance of
.BooleanAssert
assertThat
(boolean[] actual) Creates a new instance of
.BooleanArrayAssert
assertThat
(byte actual) Creates a new instance of
.ByteAssert
assertThat
(byte[] actual) Creates a new instance of
.ByteArrayAssert
assertThat
(char actual) Creates a new instance of
.CharacterAssert
assertThat
(char[] actual) Creates a new instance of
.CharArrayAssert
assertThat
(double actual) Creates a new instance of
.DoubleAssert
assertThat
(double[] actual) Creates a new instance of
.DoubleArrayAssert
assertThat
(float actual) Creates a new instance of
.FloatAssert
assertThat
(float[] actual) Creates a new instance of
.FloatArrayAssert
assertThat
(int actual) Creates a new instance of
.IntegerAssert
assertThat
(int[] actual) Creates a new instance of
.IntArrayAssert
assertThat
(long actual) Creates a new instance of
.LongAssert
assertThat
(long[] actual) Creates a new instance of
.LongArrayAssert
assertThat
(short actual) Creates a new instance of
.ShortAssert
assertThat
(short[] actual) Creates a new instance of
.ShortArrayAssert
assertThat
(File actual) Creates a new instance of
.FileAssert
assertThat
(InputStream actual) Creates a new instance of
.InputStreamAssert
assertThat
(Boolean actual) Creates a new instance of
.BooleanAssert
assertThat
(Byte actual) Creates a new instance of
.ByteAssert
assertThat
(Character actual) Creates a new instance of
.CharacterAssert
assertThat
(CharSequence actual) Creates a new instance of
.CharSequenceAssert
assertThat
(Class<?> actual) Creates a new instance ofClassAssert
assertThat
(Double actual) Creates a new instance of
.DoubleAssert
assertThat
(Float actual) Creates a new instance of
.FloatAssert
assertThat
(Integer actual) Creates a new instance of
.IntegerAssert
<T> SoftAssertionIterableAssert<T>
assertThat
(Iterable<? extends T> actual) Creates a new instance of
.IterableAssert
assertThat
(Long actual) Creates a new instance of
.LongAssert
assertThat
(Short actual) Creates a new instance of
.ShortAssert
assertThat
(String actual) Creates a new instance of
.StringAssert
assertThat
(Throwable actual) Creates a new instance of
.ThrowableAssert
assertThat
(BigDecimal actual) Creates a new instance of
.BigDecimalAssert
assertThat
(BigInteger actual) Creates a new instance of
.BigInteger
assertThat
(URI actual) Creates a new instance of
.UriAssert
assertThat
(URL actual) Creates a new instance of
.UrlAssert
assertThat
(AtomicBoolean actual) Create assertion forAtomicBoolean
.assertThat
(AtomicInteger actual) Create assertion forAtomicInteger
.assertThat
(AtomicIntegerArray actual) Create assertion forAtomicIntegerArray
.<OBJECT> AtomicIntegerFieldUpdaterAssert<OBJECT>
assertThat
(AtomicIntegerFieldUpdater<OBJECT> actual) Create assertion forAtomicIntegerFieldUpdater
.assertThat
(AtomicLong actual) Create assertion forAtomicLong
.assertThat
(AtomicLongArray actual) Create assertion forAtomicLongArray
.<OBJECT> AtomicLongFieldUpdaterAssert<OBJECT>
assertThat
(AtomicLongFieldUpdater<OBJECT> actual) Create assertion forAtomicLongFieldUpdater
.<VALUE> AtomicMarkableReferenceAssert<VALUE>
assertThat
(AtomicMarkableReference<VALUE> actual) Create assertion forAtomicMarkableReference
.<VALUE> AtomicReferenceAssert<VALUE>
assertThat
(AtomicReference<VALUE> actual) Create assertion forAtomicReference
.<ELEMENT> AtomicReferenceArrayAssert<ELEMENT>
assertThat
(AtomicReferenceArray<ELEMENT> actual) Create assertion forAtomicReferenceArray
.<FIELD,
OBJECT>
AtomicReferenceFieldUpdaterAssert<FIELD,OBJECT> assertThat
(AtomicReferenceFieldUpdater<OBJECT, FIELD> actual) Create assertion forAtomicReferenceFieldUpdater
.<VALUE> AtomicStampedReferenceAssert<VALUE>
assertThat
(AtomicStampedReference<VALUE> actual) Create assertion forAtomicStampedReference
.<RESULT> FutureAssert<RESULT>
assertThat
(Future<? extends RESULT> actual) Creates a new instance of
.FutureAssert
assertThat
(Date actual) Creates a new instance of
.DateAssert
<T> SoftAssertionIterableAssert<T>
assertThat
(Iterator<T> actual) Creates a new instance of
.IterableAssert
<T> SoftAssertionListAssert<T>
assertThat
(List<? extends T> actual) Creates a new instance of
.ListAssert
<K,
V> SoftAssertionMapAssert<K, V> assertThat
(Map<K, V> actual) Creates a new instance of
.MapAssert
<T extends Comparable<? super T>>
AbstractComparableAssert<?,T> assertThat
(T actual) Creates a new instance of
with standard comparison semantics.GenericComparableAssert
<T> ObjectArrayAssert<T>
assertThat
(T[] actual) Creates a new instance of
.ObjectArrayAssert
AbstractThrowableAssert<?,
? extends Throwable> assertThatCode
(ThrowableAssert.ThrowingCallable shouldRaiseOrNotThrowable) Allows to capture and then assert on aThrowable
more easily when used with Java 8 lambdas.AbstractThrowableAssert<?,
? extends Throwable> assertThatThrownBy
(ThrowableAssert.ThrowingCallable shouldRaiseThrowable) Allows to capture and then assert on aThrowable
more easily when used with Java 8 lambdas.Methods inherited from class org.assertj.core.api.AbstractSoftAssertions
errorsCollected, fail, fail, fail, failBecauseExceptionWasNotThrown, proxy, shouldHaveThrown, wasSuccess
-
Constructor Details
-
Java6AbstractStandardSoftAssertions
public Java6AbstractStandardSoftAssertions()
-
-
Method Details
-
assertThat
Creates a new instance of
.BigDecimalAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
assertThat
Creates a new instance of
.BigInteger
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
- Since:
- 2.7.0 / 3.7.0
-
assertThat
Creates a new instance of
.BooleanAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
assertThat
Creates a new instance of
.BooleanAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
assertThat
Creates a new instance of
.BooleanArrayAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
assertThat
Creates a new instance of
.ByteAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
assertThat
Creates a new instance of
.ByteAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
assertThat
Creates a new instance of
.ByteArrayAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
assertThat
Creates a new instance of
.CharacterAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
assertThat
Creates a new instance of
.CharArrayAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
assertThat
Creates a new instance of
.CharacterAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
assertThat
Creates a new instance of
We don't returnClassAssert
ClassAssert
as it has overridden methods to annotated withSafeVarargs
.- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
assertThat
Creates a new instance of
with standard comparison semantics.GenericComparableAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
assertThat
Creates a new instance of
.IterableAssert
We don't return
IterableAssert
as it has overridden methods to annotated withSafeVarargs
.- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
assertThat
Creates a new instance of
. TheIterableAssert
is first converted into anIterator
Iterable
We don't return
IterableAssert
as it has overridden methods to annotated withSafeVarargs
.- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
assertThat
Creates a new instance of
.DoubleAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
assertThat
Creates a new instance of
.DoubleAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
assertThat
Creates a new instance of
.DoubleArrayAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
assertThat
Creates a new instance of
.FileAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
assertThat
Creates a new instance of
.FutureAssert
- Parameters:
actual
- the actual value- Returns:
- the created assertion object
-
assertThat
Creates a new instance of
.InputStreamAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
assertThat
Creates a new instance of
.FloatAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
assertThat
Creates a new instance of
.FloatAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
assertThat
Creates a new instance of
.FloatArrayAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
assertThat
Creates a new instance of
.IntegerAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
assertThat
Creates a new instance of
.IntArrayAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
assertThat
Creates a new instance of
.IntegerAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
assertThat
Creates a new instance of
.ListAssert
We don't return
IterableAssert
as it has overridden methods to annotated withSafeVarargs
.- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
assertThat
Creates a new instance of
.LongAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
assertThat
Creates a new instance of
.LongAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
assertThat
Creates a new instance of
.LongArrayAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
assertThat
Creates a new instance of
.ObjectAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
assertThat
Creates a new instance of
.ObjectArrayAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
assertThat
Creates a new instance of
.MapAssert
We don't return
MapAssert
as it has overridden methods to annotated withSafeVarargs
.- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
assertThat
Creates a new instance of
.ShortAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
assertThat
Creates a new instance of
.ShortAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
assertThat
Creates a new instance of
.ShortArrayAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
assertThat
Creates a new instance of
.CharSequenceAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
assertThat
Creates a new instance of
.StringAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
assertThat
Creates a new instance of
.DateAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
assertThat
Create assertion forAtomicBoolean
.- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
assertThat
Create assertion forAtomicInteger
.- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
assertThat
Create assertion forAtomicIntegerArray
.- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
assertThat
public <OBJECT> AtomicIntegerFieldUpdaterAssert<OBJECT> assertThat(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
Create assertion forAtomicLong
.- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
assertThat
Create assertion forAtomicLongArray
.- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
assertThat
public <OBJECT> AtomicLongFieldUpdaterAssert<OBJECT> assertThat(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
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
public <ELEMENT> AtomicReferenceArrayAssert<ELEMENT> assertThat(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
public <FIELD,OBJECT> AtomicReferenceFieldUpdaterAssert<FIELD,OBJECT> assertThat(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
public <VALUE> AtomicMarkableReferenceAssert<VALUE> assertThat(AtomicMarkableReference<VALUE> actual) Create assertion forAtomicMarkableReference
.- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
assertThat
Create assertion forAtomicStampedReference
.- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
assertThat
Creates a new instance of
.ThrowableAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion Throwable.
-
assertThatThrownBy
public AbstractThrowableAssert<?,? extends Throwable> assertThatThrownBy(ThrowableAssert.ThrowingCallable shouldRaiseThrowable) Allows to capture and then assert on aThrowable
more easily when used with Java 8 lambdas. Java 8 example :
Java 7 example :@Test public 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 public Void call() throws Exception { 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 captured exception or
null
if none was raised by the callable.
-
assertThatCode
public AbstractThrowableAssert<?,? extends Throwable> assertThatCode(ThrowableAssert.ThrowingCallable shouldRaiseOrNotThrowable) Allows to capture and then assert on aThrowable
more 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.ThrowingCallable
does 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
assertThat
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 captured exception or
null
if none was raised by the callable. - Since:
- 3.7.0
-
assertThat
Creates a new instance of
.UriAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
assertThat
Creates a new instance of
.UrlAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-