Skip to content

Instantly share code, notes, and snippets.

@SarahElson
Last active October 5, 2023 13:39
How to Use JUnit ErrorCollector [With Examples]
package com.lambdatest.junit;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ErrorCollector;
public class ErrorCollectorTestAdd {
@Rule
public final ErrorCollector collector = new ErrorCollector();
@Test
public void testWithErrorCollector() {
collector.addError(new Throwable("error 1"));
collector.addError(new Throwable("error 2"));
collector.addError(new Throwable("error 3"));
collector.addError(new Throwable("error 4"));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment