org.assertj.core.api
Class JUnitSoftAssertions

java.lang.Object
  extended by org.assertj.core.api.AbstractSoftAssertions
      extended by org.assertj.core.api.JUnitSoftAssertions
All Implemented Interfaces:
org.junit.rules.TestRule

public class JUnitSoftAssertions
extends AbstractSoftAssertions
implements org.junit.rules.TestRule

the same as SoftAssertions, but with the following differences: First, it's a junit rule, which can be used as follows (without the assertAll())

   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.


Constructor Summary
JUnitSoftAssertions()
           
 
Method Summary
 org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base, org.junit.runner.Description description)
           
 
Methods inherited from class org.assertj.core.api.AbstractSoftAssertions
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, proxy
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JUnitSoftAssertions

public JUnitSoftAssertions()
Method Detail

apply

public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base,
                                               org.junit.runner.Description description)
Specified by:
apply in interface org.junit.rules.TestRule


Copyright © 2013–2015 AssertJ. All rights reserved.