public class Java6AbstractBDDSoftAssertions extends AbstractSoftAssertions
AbstractBDDSoftAssertions.AbstractBDDSoftAssertionsproxies| Constructor and Description |
|---|
Java6AbstractBDDSoftAssertions() |
| Modifier and Type | Method and Description |
|---|---|
AtomicBooleanAssert |
then(AtomicBoolean actual)
Create assertion for
AtomicBoolean. |
AtomicIntegerAssert |
then(AtomicInteger actual)
Create assertion for
AtomicInteger. |
AtomicIntegerArrayAssert |
then(AtomicIntegerArray actual)
Create assertion for
AtomicIntegerArray. |
<OBJECT> AtomicIntegerFieldUpdaterAssert<OBJECT> |
then(AtomicIntegerFieldUpdater<OBJECT> actual)
Create assertion for
AtomicIntegerFieldUpdater. |
AtomicLongAssert |
then(AtomicLong actual)
Create assertion for
AtomicLong. |
AtomicLongArrayAssert |
then(AtomicLongArray actual)
Create assertion for
AtomicLongArray. |
<OBJECT> AtomicLongFieldUpdaterAssert<OBJECT> |
then(AtomicLongFieldUpdater<OBJECT> actual)
Create assertion for
AtomicLongFieldUpdater. |
<VALUE> AtomicMarkableReferenceAssert<VALUE> |
then(AtomicMarkableReference<VALUE> actual)
Create assertion for
AtomicMarkableReference. |
<VALUE> AtomicReferenceAssert<VALUE> |
then(AtomicReference<VALUE> actual)
Create assertion for
AtomicReference. |
<ELEMENT> AtomicReferenceArrayAssert<ELEMENT> |
then(AtomicReferenceArray<ELEMENT> actual)
Create assertion for
AtomicReferenceArray. |
<FIELD,OBJECT> |
then(AtomicReferenceFieldUpdater<OBJECT,FIELD> actual)
Create assertion for
AtomicReferenceFieldUpdater. |
<VALUE> AtomicStampedReferenceAssert<VALUE> |
then(AtomicStampedReference<VALUE> actual)
Create assertion for
AtomicStampedReference. |
BigDecimalAssert |
then(BigDecimal actual)
Creates a new instance of
. |
BigIntegerAssert |
then(BigInteger actual)
Creates a new instance of
. |
BooleanAssert |
then(boolean actual)
Creates a new instance of
. |
BooleanAssert |
then(Boolean actual)
Creates a new instance of
. |
BooleanArrayAssert |
then(boolean[] actual)
Creates a new instance of
. |
ByteAssert |
then(byte actual)
Creates a new instance of
. |
ByteAssert |
then(Byte actual)
Creates a new instance of
. |
ByteArrayAssert |
then(byte[] actual)
Creates a new instance of
. |
CharacterAssert |
then(char actual)
Creates a new instance of
. |
CharArrayAssert |
then(char[] actual)
Creates a new instance of
. |
CharacterAssert |
then(Character actual)
Creates a new instance of
. |
CharSequenceAssert |
then(CharSequence actual)
Creates a new instance of
. |
SoftAssertionClassAssert |
then(Class<?> actual)
Creates a new instance of
|
DateAssert |
then(Date actual)
Creates a new instance of
. |
DoubleAssert |
then(double actual)
Creates a new instance of
. |
DoubleAssert |
then(Double actual)
Creates a new instance of
. |
DoubleArrayAssert |
then(double[] actual)
Creates a new instance of
. |
FileAssert |
then(File actual)
Creates a new instance of
. |
FloatAssert |
then(float actual)
Creates a new instance of
. |
FloatAssert |
then(Float actual)
Creates a new instance of
. |
FloatArrayAssert |
then(float[] actual)
Creates a new instance of
. |
<RESULT> FutureAssert<RESULT> |
then(Future<RESULT> actual)
Creates a new instance of
. |
InputStreamAssert |
then(InputStream actual)
Creates a new instance of
. |
IntegerAssert |
then(int actual)
Creates a new instance of
. |
IntArrayAssert |
then(int[] actual)
Creates a new instance of
. |
IntegerAssert |
then(Integer actual)
Creates a new instance of
. |
<T> SoftAssertionIterableAssert<T> |
then(Iterable<? extends T> actual)
Creates a new instance of
. |
<T> SoftAssertionIterableAssert<T> |
then(Iterator<? extends T> actual)
Creates a new instance of
. |
<T> SoftAssertionListAssert<T> |
then(List<? extends T> actual)
Creates a new instance of
. |
LongAssert |
then(long actual)
Creates a new instance of
. |
LongAssert |
then(Long actual)
Creates a new instance of
. |
LongArrayAssert |
then(long[] actual)
Creates a new instance of
. |
<K,V> SoftAssertionMapAssert<K,V> |
then(Map<K,V> actual)
Creates a new instance of
. |
ShortAssert |
then(short actual)
Creates a new instance of
. |
ShortAssert |
then(Short actual)
Creates a new instance of
. |
ShortArrayAssert |
then(short[] actual)
Creates a new instance of
. |
StringAssert |
then(String actual)
Creates a new instance of
. |
<T> ObjectAssert<T> |
then(T actual)
Creates a new instance of
. |
<T extends Comparable<? super T>> |
then(T actual)
Creates a new instance of
with
standard comparison semantics. |
<T> ObjectArrayAssert<T> |
then(T[] actual)
Creates a new instance of
. |
ThrowableAssert |
then(Throwable actual)
Creates a new instance of
. |
UriAssert |
then(URI actual)
Creates a new instance of
. |
AbstractUrlAssert<?> |
then(URL actual)
Creates a new instance of
. |
AbstractThrowableAssert<?,? extends Throwable> |
thenCode(ThrowableAssert.ThrowingCallable shouldRaiseOrNotThrowable)
Allows to capture and then assert on a
Throwable more easily when used with Java 8 lambdas. |
AbstractThrowableAssert<?,? extends Throwable> |
thenThrownBy(ThrowableAssert.ThrowingCallable shouldRaiseThrowable)
Allows to capture and then assert on a
Throwable more easily when used with Java 8 lambdas. |
AbstractThrowableAssert<?,? extends Throwable> |
thenThrownBy(ThrowableAssert.ThrowingCallable shouldRaiseThrowable,
String description,
Object... args)
Allows to capture and then assert on a
Throwable like thenThrownBy(ThrowingCallable) but this method
let you set the assertion description the same way you do with as(String, Object...). |
errorsCollected, fail, fail, fail, failBecauseExceptionWasNotThrown, proxy, shouldHaveThrown, wasSuccesspublic BigDecimalAssert then(BigDecimal actual)
BigDecimalAssert.actual - the actual value.public BigIntegerAssert then(BigInteger actual)
BigIntegerAssert.actual - the actual value.public BooleanAssert then(boolean actual)
BooleanAssert.actual - the actual value.public BooleanAssert then(Boolean actual)
BooleanAssert.actual - the actual value.public BooleanArrayAssert then(boolean[] actual)
BooleanArrayAssert.actual - the actual value.public ByteAssert then(byte actual)
ByteAssert.actual - the actual value.public ByteAssert then(Byte actual)
ByteAssert.actual - the actual value.public ByteArrayAssert then(byte[] actual)
ByteArrayAssert.actual - the actual value.public CharacterAssert then(char actual)
CharacterAssert.actual - the actual value.public CharArrayAssert then(char[] actual)
CharArrayAssert.actual - the actual value.public CharacterAssert then(Character actual)
CharacterAssert.actual - the actual value.public SoftAssertionClassAssert then(Class<?> actual)
ClassAssert
We don't return ClassAssert as it has overridden methods to annotated with SafeVarargs.
actual - the actual value.public <T extends Comparable<? super T>> AbstractComparableAssert<?,T> then(T actual)
GenericComparableAssert with
standard comparison semantics.T - the type of actual.actual - the actual value.public <T> SoftAssertionIterableAssert<T> then(Iterable<? extends T> actual)
IterableAssert.T - the type of elements.actual - the actual value.public <T> SoftAssertionIterableAssert<T> then(Iterator<? extends T> actual)
T - the type of elements.actual - the actual value.public DoubleAssert then(double actual)
DoubleAssert.actual - the actual value.public DoubleAssert then(Double actual)
DoubleAssert.actual - the actual value.public DoubleArrayAssert then(double[] actual)
DoubleArrayAssert.actual - the actual value.public FileAssert then(File actual)
FileAssert.actual - the actual value.public <RESULT> FutureAssert<RESULT> then(Future<RESULT> actual)
FutureAssert.RESULT - the type of the value contained in the Future.actual - the actual value.public InputStreamAssert then(InputStream actual)
InputStreamAssert.actual - the actual value.public FloatAssert then(float actual)
FloatAssert.actual - the actual value.public FloatAssert then(Float actual)
FloatAssert.actual - the actual value.public FloatArrayAssert then(float[] actual)
FloatArrayAssert.actual - the actual value.public IntegerAssert then(int actual)
IntegerAssert.actual - the actual value.public IntArrayAssert then(int[] actual)
IntArrayAssert.actual - the actual value.public IntegerAssert then(Integer actual)
IntegerAssert.actual - the actual value.public <T> SoftAssertionListAssert<T> then(List<? extends T> actual)
ListAssert.T - the type of elements.actual - the actual value.public LongAssert then(long actual)
LongAssert.actual - the actual value.public LongAssert then(Long actual)
LongAssert.actual - the actual value.public LongArrayAssert then(long[] actual)
LongArrayAssert.actual - the actual value.public <T> ObjectAssert<T> then(T actual)
ObjectAssert.T - the type of the actual value.actual - the actual value.public <T> ObjectArrayAssert<T> then(T[] actual)
ObjectArrayAssert.T - the type of elements.actual - the actual value.public <K,V> SoftAssertionMapAssert<K,V> then(Map<K,V> actual)
MapAssert.
We don't return MapAssert as it has overridden methods to annotated with SafeVarargs.
K - the type of keys in the map.V - the type of values in the map.actual - the actual value.public ShortAssert then(short actual)
ShortAssert.actual - the actual value.public ShortAssert then(Short actual)
ShortAssert.actual - the actual value.public ShortArrayAssert then(short[] actual)
ShortArrayAssert.actual - the actual value.public CharSequenceAssert then(CharSequence actual)
CharSequenceAssert.actual - the actual value.public StringAssert then(String actual)
StringAssert.actual - the actual value.public DateAssert then(Date actual)
DateAssert.actual - the actual value.public AtomicBooleanAssert then(AtomicBoolean actual)
AtomicBoolean.actual - the actual value.public AtomicIntegerAssert then(AtomicInteger actual)
AtomicInteger.actual - the actual value.public AtomicIntegerArrayAssert then(AtomicIntegerArray actual)
AtomicIntegerArray.actual - the actual value.public <OBJECT> AtomicIntegerFieldUpdaterAssert<OBJECT> then(AtomicIntegerFieldUpdater<OBJECT> actual)
AtomicIntegerFieldUpdater.OBJECT - The type of the object holding the updatable fieldactual - the actual value.public AtomicLongAssert then(AtomicLong actual)
AtomicLong.actual - the actual value.public AtomicLongArrayAssert then(AtomicLongArray actual)
AtomicLongArray.actual - the actual value.public <OBJECT> AtomicLongFieldUpdaterAssert<OBJECT> then(AtomicLongFieldUpdater<OBJECT> actual)
AtomicLongFieldUpdater.OBJECT - the type of the object holding the updatable fieldactual - the actual value.public <VALUE> AtomicReferenceAssert<VALUE> then(AtomicReference<VALUE> actual)
AtomicReference.VALUE - the type of object referred to by this referenceactual - the actual value.public <ELEMENT> AtomicReferenceArrayAssert<ELEMENT> then(AtomicReferenceArray<ELEMENT> actual)
AtomicReferenceArray.ELEMENT - the type of object referred to by the AtomicReferenceArray.actual - the actual value.public <FIELD,OBJECT> AtomicReferenceFieldUpdaterAssert<FIELD,OBJECT> then(AtomicReferenceFieldUpdater<OBJECT,FIELD> actual)
AtomicReferenceFieldUpdater.FIELD - The type of the fieldOBJECT - the type of the object holding the updatable fieldactual - the actual value.public <VALUE> AtomicMarkableReferenceAssert<VALUE> then(AtomicMarkableReference<VALUE> actual)
AtomicMarkableReference.VALUE - the type of object referred to by this referenceactual - the actual value.public <VALUE> AtomicStampedReferenceAssert<VALUE> then(AtomicStampedReference<VALUE> actual)
AtomicStampedReference.VALUE - the type of value referred to by this referenceactual - the actual value.public ThrowableAssert then(Throwable actual)
ThrowableAssert.actual - the actual value.public AbstractThrowableAssert<?,? extends Throwable> thenThrownBy(ThrowableAssert.ThrowingCallable shouldRaiseThrowable)
Throwable more easily when used with Java 8 lambdas.
Java 8 example :
@Test
public void testException() {
BDDSoftAssertions softly = new BDDSoftAssertions();
softly.thenThrownBy(() -> { throw new Exception("boom!"); }).isInstanceOf(Exception.class)
.hasMessageContaining("boom");
}
Java 7 example :
BDDSoftAssertions softly = new BDDSoftAssertions();
softly.thenThrownBy(new ThrowingCallable() {
@Override
public Void call() throws Exception {
throw new Exception("boom!");
}
}).isInstanceOf(Exception.class)
.hasMessageContaining("boom");
If the provided ThrowableAssert.ThrowingCallable does not raise an exception, an error is immediately thrown,
in that case the test description provided with as(String, Object...) is not honored.Assertions.catchThrowable(ThrowableAssert.ThrowingCallable) as shown below:
// assertion will fail but "display me" won't appear in the error
softly.thenThrownBy(() -> {}).as("display me")
.isInstanceOf(Exception.class);
// assertion will fail AND "display me" will appear in the error
Throwable thrown = catchThrowable(() -> {});
softly.then(thrown).as("display me")
.isInstanceOf(Exception.class);
Alternatively you can also use thenCode(ThrowingCallable) for the test description provided
with as(String, Object...) to always be honored.shouldRaiseThrowable - The ThrowableAssert.ThrowingCallable or lambda with the code that should raise the throwable.null if none was raised by the callable.public AbstractThrowableAssert<?,? extends Throwable> thenThrownBy(ThrowableAssert.ThrowingCallable shouldRaiseThrowable, String description, Object... args)
Throwable like thenThrownBy(ThrowingCallable) but this method
let you set the assertion description the same way you do with as(String, Object...).
Example:
@Test
public void testException() {
BDDSoftAssertions softly = new BDDSoftAssertions();
// if this assertion failed (but it doesn't), the error message would start with [Test explosive code]
softly.thenThrownBy(() -> { throw new IOException("boom!") }, "Test explosive code")
.isInstanceOf(IOException.class)
.hasMessageContaining("boom");
}
If the provided ThrowingCallable does 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.thenThrownBy(() -> {}).as("display me")
.isInstanceOf(Exception.class);
// assertion will fail AND "display me" will appear in the error message
softly.thenThrownBy(() -> {}, "display me")
.isInstanceOf(Exception.class);shouldRaiseThrowable - The ThrowableAssert.ThrowingCallable or lambda with the code that should raise the throwable.description - the new description to set.args - optional parameter if description is a format String.ThrowableAssert.public AbstractThrowableAssert<?,? extends Throwable> thenCode(ThrowableAssert.ThrowingCallable shouldRaiseOrNotThrowable)
Throwable more easily when used with Java 8 lambdas.
Example :
ThrowingCallable callable = () -> {
throw new Exception("boom!");
};
// assertion succeeds
thenCode(callable).isInstanceOf(Exception.class)
.hasMessageContaining("boom");
// assertion fails
thenCode(callable).doesNotThrowAnyException();
Contrary to thenThrownBy(ThrowingCallable) the test description provided with
as(String, Object...) is always honored 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);
This method was not named then because the java compiler reported it ambiguous when used directly with a lambda :(
shouldRaiseOrNotThrowable - The ThrowableAssert.ThrowingCallable or lambda with the code that should raise the throwable.null if none was raised by the callable.public UriAssert then(URI actual)
UriAssert.actual - the actual value.public AbstractUrlAssert<?> then(URL actual)
UrlAssert.actual - the actual value.Copyright © 2014–2018 AssertJ. All rights reserved.