Package org.assertj.core.api
Class JUnitSoftAssertions
java.lang.Object
org.assertj.core.api.AbstractSoftAssertions
org.assertj.core.api.Java6AbstractStandardSoftAssertions
org.assertj.core.api.AbstractStandardSoftAssertions
org.assertj.core.api.JUnitSoftAssertions
- All Implemented Interfaces:
org.junit.rules.TestRule
public class JUnitSoftAssertions
extends AbstractStandardSoftAssertions
implements org.junit.rules.TestRule
Same as
First, it's a junit rule, which can be used without having to call
SoftAssertions
, but with the following differences: First, it's a junit rule, which can be used without having to call
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.-
Field Summary
Fields inherited from class org.assertj.core.api.AbstractSoftAssertions
proxies
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.junit.runners.model.Statement
apply
(org.junit.runners.model.Statement base, org.junit.runner.Description description) Methods inherited from class org.assertj.core.api.AbstractStandardSoftAssertions
assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat
Methods inherited from class org.assertj.core.api.Java6AbstractStandardSoftAssertions
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, assertThatThrownBy
Methods inherited from class org.assertj.core.api.AbstractSoftAssertions
errorsCollected, fail, fail, fail, failBecauseExceptionWasNotThrown, proxy, shouldHaveThrown, wasSuccess
-
Constructor Details
-
JUnitSoftAssertions
public JUnitSoftAssertions()
-
-
Method Details
-
apply
public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base, org.junit.runner.Description description) - Specified by:
apply
in interfaceorg.junit.rules.TestRule
-