Package org.assertj.core.api
Class Java6AbstractBDDSoftAssertions
java.lang.Object
org.assertj.core.api.AbstractSoftAssertions
org.assertj.core.api.Java6AbstractBDDSoftAssertions
- Direct Known Subclasses:
AbstractBDDSoftAssertions
,Java6BDDSoftAssertions
,Java6JUnitBDDSoftAssertions
AbstractBDDSoftAssertions compatible with Android. Duplicated from
AbstractBDDSoftAssertions
.- 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 TypeMethodDescriptionthen
(boolean actual) Creates a new instance of
.BooleanAssert
then
(boolean[] actual) Creates a new instance of
.BooleanArrayAssert
then
(byte actual) Creates a new instance of
.ByteAssert
then
(byte[] actual) Creates a new instance of
.ByteArrayAssert
then
(char actual) Creates a new instance of
.CharacterAssert
then
(char[] actual) Creates a new instance of
.CharArrayAssert
then
(double actual) Creates a new instance of
.DoubleAssert
then
(double[] actual) Creates a new instance of
.DoubleArrayAssert
then
(float actual) Creates a new instance of
.FloatAssert
then
(float[] actual) Creates a new instance of
.FloatArrayAssert
then
(int actual) Creates a new instance of
.IntegerAssert
then
(int[] actual) Creates a new instance of
.IntArrayAssert
then
(long actual) Creates a new instance of
.LongAssert
then
(long[] actual) Creates a new instance of
.LongArrayAssert
then
(short actual) Creates a new instance of
.ShortAssert
then
(short[] actual) Creates a new instance of
.ShortArrayAssert
Creates a new instance of
.FileAssert
then
(InputStream actual) Creates a new instance of
.InputStreamAssert
Creates a new instance of
.BooleanAssert
Creates a new instance of
.ByteAssert
Creates a new instance of
.CharacterAssert
then
(CharSequence actual) Creates a new instance of
.CharSequenceAssert
Creates a new instance ofClassAssert
Creates a new instance of
.DoubleAssert
Creates a new instance of
.FloatAssert
Creates a new instance of
.IntegerAssert
<T> SoftAssertionIterableAssert<T>
Creates a new instance of
.IterableAssert
Creates a new instance of
.LongAssert
Creates a new instance of
.ShortAssert
Creates a new instance of
.StringAssert
Creates a new instance of
.ThrowableAssert
then
(BigDecimal actual) Creates a new instance of
.BigDecimalAssert
then
(BigInteger actual) Creates a new instance of
.BigIntegerAssert
Creates a new instance of
.UriAssert
Creates a new instance of
.UrlAssert
then
(AtomicBoolean actual) Create assertion forAtomicBoolean
.then
(AtomicInteger actual) Create assertion forAtomicInteger
.then
(AtomicIntegerArray actual) Create assertion forAtomicIntegerArray
.<OBJECT> AtomicIntegerFieldUpdaterAssert<OBJECT>
then
(AtomicIntegerFieldUpdater<OBJECT> actual) Create assertion forAtomicIntegerFieldUpdater
.then
(AtomicLong actual) Create assertion forAtomicLong
.then
(AtomicLongArray actual) Create assertion forAtomicLongArray
.<OBJECT> AtomicLongFieldUpdaterAssert<OBJECT>
then
(AtomicLongFieldUpdater<OBJECT> actual) Create assertion forAtomicLongFieldUpdater
.<VALUE> AtomicMarkableReferenceAssert<VALUE>
then
(AtomicMarkableReference<VALUE> actual) Create assertion forAtomicMarkableReference
.<VALUE> AtomicReferenceAssert<VALUE>
then
(AtomicReference<VALUE> actual) Create assertion forAtomicReference
.<ELEMENT> AtomicReferenceArrayAssert<ELEMENT>
then
(AtomicReferenceArray<ELEMENT> actual) Create assertion forAtomicReferenceArray
.<FIELD,
OBJECT>
AtomicReferenceFieldUpdaterAssert<FIELD,OBJECT> then
(AtomicReferenceFieldUpdater<OBJECT, FIELD> actual) Create assertion forAtomicReferenceFieldUpdater
.<VALUE> AtomicStampedReferenceAssert<VALUE>
then
(AtomicStampedReference<VALUE> actual) Create assertion forAtomicStampedReference
.<RESULT> FutureAssert<RESULT>
Creates a new instance of
.FutureAssert
Creates a new instance of
.DateAssert
<T> SoftAssertionIterableAssert<T>
Creates a new instance of
.IterableAssert
<T> SoftAssertionListAssert<T>
Creates a new instance of
.ListAssert
<K,
V> SoftAssertionMapAssert<K, V> Creates a new instance of
.MapAssert
<T extends Comparable<? super T>>
AbstractComparableAssert<?,T> then
(T actual) Creates a new instance of
with standard comparison semantics.GenericComparableAssert
<T> ObjectArrayAssert<T>
then
(T[] actual) Creates a new instance of
.ObjectArrayAssert
AbstractThrowableAssert<?,
? extends Throwable> thenCode
(ThrowableAssert.ThrowingCallable shouldRaiseOrNotThrowable) Allows to capture and then assert on aThrowable
more easily when used with Java 8 lambdas.AbstractThrowableAssert<?,
? extends Throwable> thenThrownBy
(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
-
Java6AbstractBDDSoftAssertions
public Java6AbstractBDDSoftAssertions()
-
-
Method Details
-
then
Creates a new instance of
.BigDecimalAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
then
Creates a new instance of
.BigIntegerAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
- Since:
- 2.7.0 / 3.7.0
-
then
Creates a new instance of
.BooleanAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
then
Creates a new instance of
.BooleanAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
then
Creates a new instance of
.BooleanArrayAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
then
Creates a new instance of
.ByteAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
then
Creates a new instance of
.ByteAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
then
Creates a new instance of
.ByteArrayAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
then
Creates a new instance of
.CharacterAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
then
Creates a new instance of
.CharArrayAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
then
Creates a new instance of
.CharacterAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
then
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.
-
then
Creates a new instance of
with standard comparison semantics.GenericComparableAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
then
Creates a new instance of
.IterableAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
then
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
then
Creates a new instance of
.DoubleAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
then
Creates a new instance of
.DoubleAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
then
Creates a new instance of
.DoubleArrayAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
then
Creates a new instance of
.FileAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
then
Creates a new instance of
.FutureAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
- Since:
- 2.7.0 / 3.7.0
-
then
Creates a new instance of
.InputStreamAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
then
Creates a new instance of
.FloatAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
then
Creates a new instance of
.FloatAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
then
Creates a new instance of
.FloatArrayAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
then
Creates a new instance of
.IntegerAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
then
Creates a new instance of
.IntArrayAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
then
Creates a new instance of
.IntegerAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
then
Creates a new instance of
.ListAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
then
Creates a new instance of
.LongAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
then
Creates a new instance of
.LongAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
then
Creates a new instance of
.LongArrayAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
then
Creates a new instance of
.ObjectAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
then
Creates a new instance of
.ObjectArrayAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
then
Creates a new instance of
. We don't returnMapAssert
MapAssert
as it has overridden methods to annotated withSafeVarargs
.- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
then
Creates a new instance of
.ShortAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
then
Creates a new instance of
.ShortAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
then
Creates a new instance of
.ShortArrayAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
then
Creates a new instance of
.CharSequenceAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
then
Creates a new instance of
.StringAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
then
Creates a new instance of
.DateAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
then
Create assertion forAtomicBoolean
.- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
- Since:
- 2.7.0 / 3.7.0
-
then
Create assertion forAtomicInteger
.- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
- Since:
- 2.7.0 / 3.7.0
-
then
Create assertion forAtomicIntegerArray
.- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
- Since:
- 2.7.0 / 3.7.0
-
then
public <OBJECT> AtomicIntegerFieldUpdaterAssert<OBJECT> then(AtomicIntegerFieldUpdater<OBJECT> actual) Create assertion forAtomicIntegerFieldUpdater
.- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
- Since:
- 2.7.0 / 3.7.0
-
then
Create assertion forAtomicLong
.- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
- Since:
- 2.7.0 / 3.7.0
-
then
Create assertion forAtomicLongArray
.- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
- Since:
- 2.7.0 / 3.7.0
-
then
Create assertion forAtomicLongFieldUpdater
.- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
- Since:
- 2.7.0 / 3.7.0
-
then
Create assertion forAtomicReference
.- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
- Since:
- 2.7.0 / 3.7.0
-
then
Create assertion forAtomicReferenceArray
.- Type Parameters:
ELEMENT
- the type of object referred to by theAtomicReferenceArray
.- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
- Since:
- 2.7.0 / 3.7.0
-
then
public <FIELD,OBJECT> AtomicReferenceFieldUpdaterAssert<FIELD,OBJECT> then(AtomicReferenceFieldUpdater<OBJECT, FIELD> actual) Create assertion forAtomicReferenceFieldUpdater
.- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
- Since:
- 2.7.0 / 3.7.0
-
then
Create assertion forAtomicMarkableReference
.- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
- Since:
- 2.7.0 / 3.7.0
-
then
Create assertion forAtomicStampedReference
.- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
- Since:
- 2.7.0 / 3.7.0
-
then
Creates a new instance of
.ThrowableAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion Throwable.
-
thenThrownBy
public AbstractThrowableAssert<?,? extends Throwable> thenThrownBy(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() { BDDSoftAssertions softly = new BDDSoftAssertions(); softly.thenThrownBy(() -> { throw new Exception("boom!"); }).isInstanceOf(Exception.class) .hasMessageContaining("boom"); }
BDDSoftAssertions softly = new BDDSoftAssertions(); softly.thenThrownBy(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.
-
thenCode
public AbstractThrowableAssert<?,? extends Throwable> thenCode(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 thenCode(callable).isInstanceOf(Exception.class) .hasMessageContaining("boom"); // assertion fails thenCode(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, usethenCode(ThrowableAssert.ThrowingCallable)
as shown below.ThrowingCallable doNothing = () -> { // do nothing }; // assertion fails and "display me" appears in the assertion error thenCode(doNothing).as("display me") .isInstanceOf(Exception.class); // assertion will fail AND "display me" will appear in the error Throwable thrown = catchThrowable(doNothing); thenCode(thrown).as("display me") .isInstanceOf(Exception.class);
This method was not named
then
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
-
then
Creates a new instance of
.UriAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-
then
Creates a new instance of
.UrlAssert
- Parameters:
actual
- the actual value.- Returns:
- the created assertion object.
-