Monday, September 5, 2016

collect errors in junit

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
import org.hamcrest.CoreMatchers;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ErrorCollector;

public class CadesServiceTest {
    @Rule
    public ErrorCollector collector = new ErrorCollector();

    @Test
    public void test() {
        collector.checkThat("message", "actual", CoreMatchers.equalTo("expected"));
        collector.checkThat("message 2", "actual 2", CoreMatchers.equalTo("expected"));
        collector.checkThat("message 3", "actual 3", CoreMatchers.equalTo("expected"));
    }
}

No comments:

Post a Comment