use of org.junit.runner.Description in project mockito by mockito.
the class ConsoleSpammingMockitoJUnitRunner method run.
@Override
public void run(RunNotifier notifier) {
RunListener listener = new RunListener() {
WarningsCollector warningsCollector;
@Override
public void testStarted(Description description) throws Exception {
warningsCollector = new WarningsCollector();
}
@Override
public void testFailure(Failure failure) throws Exception {
logger.log(warningsCollector.getWarnings());
}
};
notifier.addListener(listener);
runner.run(notifier);
}
use of org.junit.runner.Description in project mockito by mockito.
the class VerboseMockitoJUnitRunner method run.
@Override
public void run(RunNotifier notifier) {
//a listener that changes the failure's exception in a very hacky way...
RunListener listener = new RunListener() {
WarningsCollector warningsCollector;
@Override
public void testStarted(Description description) throws Exception {
warningsCollector = new WarningsCollector();
}
@Override
@SuppressWarnings("deprecation")
public void testFailure(final Failure failure) throws Exception {
String warnings = warningsCollector.getWarnings();
new JUnitFailureHacker().appendWarnings(failure, warnings);
}
};
notifier.addFirstListener(listener);
runner.run(notifier);
}
use of org.junit.runner.Description in project mockito by mockito.
the class ConsoleSpammingMockitoJUnitRunnerTest method shouldDelegateToGetDescription.
//TODO add sensible tests
@Test
public void shouldDelegateToGetDescription() throws Exception {
//given
final Description expectedDescription = Description.createSuiteDescription(this.getClass());
runner = new ConsoleSpammingMockitoJUnitRunner(loggerStub, new InternalRunnerStub() {
public Description getDescription() {
return expectedDescription;
}
});
//when
Description description = runner.getDescription();
//then
assertEquals(expectedDescription, description);
}
use of org.junit.runner.Description in project pinpoint by naver.
the class PinpointPluginTestStatement method toFailure.
private Failure toFailure(Description parentDescription, String displayName, String exceptionClass, String message, List<String> trace) {
Description desc = findDescription(parentDescription, displayName);
Exception exception = toException(message, exceptionClass, trace);
Failure failure = new Failure(desc, exception);
return failure;
}
use of org.junit.runner.Description in project neo4j by neo4j.
the class ResourceRule method fileInExistingDirectory.
public static ResourceRule<File> fileInExistingDirectory(final Supplier<? extends FileSystemAbstraction> fs) {
return new ResourceRule<File>() {
@Override
protected File createResource(Description description) {
File path = path(description);
fs.get().mkdir(path.getParentFile());
return path;
}
};
}
Aggregations