use of org.junit.runner.Description in project joynr by bmwcarit.
the class IltConsumerJUnitListener method testAssumptionFailure.
// the following methods are called by JUnit framework
// called when an atomic test flags that it assumes a condition
// that is false
public void testAssumptionFailure(Failure failure) {
LOG.info(">>> testAssumptionFailure called");
Description description = failure.getDescription();
printDescription(description, 1);
// should have been created already in previous call to testStarted
TestSuiteResultsStore store = getStore(description);
store.errors++;
LOG.info("<<< testAssumptionFailure called");
}
use of org.junit.runner.Description in project ant by apache.
the class CustomJUnit4TestAdapterCache method getNotifier.
public RunNotifier getNotifier(final TestResult result) {
final IgnoredTestResult resultWrapper = (IgnoredTestResult) result;
RunNotifier notifier = new RunNotifier();
notifier.addListener(new RunListener() {
@Override
public void testFailure(Failure failure) throws Exception {
result.addError(asTest(failure.getDescription()), failure.getException());
}
@Override
public void testFinished(Description description) throws Exception {
result.endTest(asTest(description));
}
@Override
public void testStarted(Description description) throws Exception {
result.startTest(asTest(description));
}
@Override
public void testIgnored(Description description) throws Exception {
if (resultWrapper != null) {
resultWrapper.testIgnored(asTest(description));
}
}
@Override
public void testAssumptionFailure(Failure failure) {
if (resultWrapper != null) {
resultWrapper.testAssumptionFailure(asTest(failure.getDescription()), failure.getException());
}
}
});
return notifier;
}
use of org.junit.runner.Description in project junit-dataprovider by TNG.
the class DataProviderFilterTest method testShouldRunShouldReturnTrueWhenDescriptionHavingSomeRandomCodeBetweenMethodNameAndClass.
@Test
public void testShouldRunShouldReturnTrueWhenDescriptionHavingSomeRandomCodeBetweenMethodNameAndClass() {
// Given:
doReturn("Method testMain(com.tngtech.Clazz)").when(filter).describe();
Description description = setupDescription(true, "testMain 298zBZ=)& %(/$(=93A SD4)i(qzt)487 5z2 59isf&(com.tngtech.Clazz)");
// When:
boolean result = underTest.shouldRun(description);
// Then:
assertThat(result).isTrue();
}
use of org.junit.runner.Description in project junit-dataprovider by TNG.
the class DataProviderFilterTest method testShouldRunShouldReturnTrueWhenDescriptionHaveOnlyMethodNameAndEqualsExactlyWithoutPackage.
@Test
public void testShouldRunShouldReturnTrueWhenDescriptionHaveOnlyMethodNameAndEqualsExactlyWithoutPackage() {
// Given:
doReturn("Method testMain(Clazz)").when(filter).describe();
Description description = setupDescription(true, "testMain(Clazz)");
// When:
boolean result = underTest.shouldRun(description);
// Then:
assertThat(result).isTrue();
}
use of org.junit.runner.Description in project junit-dataprovider by TNG.
the class DataProviderFilterTest method testShouldRunShouldReturnFalseWhenDescriptionDoesNotHaveExpectedClassName.
@Test
public void testShouldRunShouldReturnFalseWhenDescriptionDoesNotHaveExpectedClassName() {
// Given:
doReturn("Method testMain[1: ](com.tngtech.Clazz)").when(filter).describe();
Description description = setupDescription(true, "testMain[1: ](com.tngtech.ClazzOther)");
// When:
boolean result = underTest.shouldRun(description);
// Then:
assertThat(result).isFalse();
}
Aggregations