public class JUnitSoftAssertions extends AbstractStandardSoftAssertions implements org.junit.rules.TestRule
SoftAssertions
, but with the following differences: assertAll()
,
example:
public class SoftlyTest {
@Rule
public final JUnitSoftAssertions softly = new JUnitSoftAssertions();
@Test
public void testSoftly() throws Exception {
softly.assertThat(1).isEqualTo(2);
softly.assertThat(Lists.newArrayList(1, 2)).containsOnly(1, 2);
}
}
Second, the failures are recognized by IDE's (like IntelliJ IDEA) which open a comparison window.AbstractSoftAssertions.ThrowingRunnable
proxies
ARRAY, ATOMIC_BOOLEAN, ATOMIC_INTEGER, ATOMIC_INTEGER_ARRAY, ATOMIC_INTEGER_FIELD_UPDATER, ATOMIC_LONG, ATOMIC_LONG_ARRAY, ATOMIC_LONG_FIELD_UPDATER, ATOMIC_MARKABLE_REFERENCE, ATOMIC_REFERENCE, ATOMIC_REFERENCE_ARRAY, ATOMIC_REFERENCE_FIELD_UPDATER, ATOMIC_STAMPED_REFERENCE, BIG_DECIMAL, BIG_INTEGER, BOOLEAN, BOOLEAN_ARRAY, BYTE, BYTE_ARRAY, CHAR_ARRAY, CHAR_SEQUENCE, CHARACTER, CLASS, COMPLETABLE_FUTURE, COMPLETION_STAGE, DATE, DOUBLE, DOUBLE_ARRAY, DOUBLE_PREDICATE, DOUBLE_STREAM, FILE, FLOAT, FLOAT_ARRAY, FUTURE, INPUT_STREAM, INSTANT, INT_ARRAY, INT_PREDICATE, INT_STREAM, INTEGER, ITERABLE, ITERATOR, LIST, LOCAL_DATE, LOCAL_DATE_TIME, LOCAL_TIME, LONG, LONG_ARRAY, LONG_PREDICATE, LONG_STREAM, MAP, OFFSET_DATE_TIME, OFFSET_TIME, OPTIONAL, OPTIONAL_DOUBLE, OPTIONAL_INT, OPTIONAL_LONG, PATH, PREDICATE, SHORT, SHORT_ARRAY, STREAM, STRING, STRING_BUFFER, STRING_BUILDER, THROWABLE, URI_TYPE, URL_TYPE, ZONED_DATE_TIME
Constructor and Description |
---|
JUnitSoftAssertions() |
Modifier and Type | Method and Description |
---|---|
org.junit.runners.model.Statement |
apply(org.junit.runners.model.Statement base,
org.junit.runner.Description description) |
assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat
assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThatCode, assertThatObject, assertThatThrownBy, assertThatThrownBy
check, decorateErrorsCollected, errorsCollected, fail, fail, fail, failBecauseExceptionWasNotThrown, proxy, shouldHaveThrown, wasSuccess
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
array, atomicIntegerFieldUpdater, atomicLongFieldUpdater, atomicMarkableReference, atomicReference, atomicReferenceArray, atomicReferenceFieldUpdater, atomicStampedReference, comparable, completableFuture, completionStage, future, iterable, iterator, list, map, optional, predicate, stream, type