Search in sources :

Example 11 with EachTestNotifier

use of org.junit.internal.runners.model.EachTestNotifier in project cucumber-jvm by cucumber.

the class JUnitReporterTest method after_with_pending_exception_non_strict.

@Test
public void after_with_pending_exception_non_strict() {
    createNonStrictReporter();
    createDefaultRunNotifier();
    Result result = mock(Result.class);
    Match match = mock(Match.class);
    when(result.getStatus()).thenReturn("Pending");
    when(result.getError()).thenReturn(new PendingException());
    EachTestNotifier executionUnitNotifier = mock(EachTestNotifier.class);
    jUnitReporter.executionUnitNotifier = executionUnitNotifier;
    jUnitReporter.after(match, result);
    jUnitReporter.finishExecutionUnit();
    verify(executionUnitNotifier).fireTestIgnored();
}
Also used : EachTestNotifier(org.junit.internal.runners.model.EachTestNotifier) PendingException(cucumber.api.PendingException) Result(gherkin.formatter.model.Result) Match(gherkin.formatter.model.Match) Test(org.junit.Test)

Example 12 with EachTestNotifier

use of org.junit.internal.runners.model.EachTestNotifier in project cucumber-jvm by cucumber.

the class JUnitReporterTest method before_with_pending_exception_strict.

@Test
public void before_with_pending_exception_strict() {
    createStrictReporter();
    createDefaultRunNotifier();
    Result result = mock(Result.class);
    Match match = mock(Match.class);
    when(result.getStatus()).thenReturn("Pending");
    when(result.getError()).thenReturn(new PendingException());
    EachTestNotifier executionUnitNotifier = mock(EachTestNotifier.class);
    jUnitReporter.executionUnitNotifier = executionUnitNotifier;
    jUnitReporter.before(match, result);
    verifyAddFailureWithPendingException(executionUnitNotifier);
}
Also used : EachTestNotifier(org.junit.internal.runners.model.EachTestNotifier) PendingException(cucumber.api.PendingException) Result(gherkin.formatter.model.Result) Match(gherkin.formatter.model.Match) Test(org.junit.Test)

Example 13 with EachTestNotifier

use of org.junit.internal.runners.model.EachTestNotifier in project cucumber-jvm by cucumber.

the class JUnitReporterTest method result_with_pending_step_strict.

@Test
public void result_with_pending_step_strict() {
    createStrictReporter();
    createDefaultRunNotifier();
    Result result = mock(Result.class);
    when(result.getError()).thenReturn(new PendingException());
    EachTestNotifier stepNotifier = mock(EachTestNotifier.class);
    jUnitReporter.stepNotifier = stepNotifier;
    EachTestNotifier executionUnitNotifier = mock(EachTestNotifier.class);
    jUnitReporter.executionUnitNotifier = executionUnitNotifier;
    jUnitReporter.result(result);
    verify(stepNotifier, times(1)).fireTestStarted();
    verify(stepNotifier, times(1)).fireTestFinished();
    verifyAddFailureWithPendingException(stepNotifier);
    verifyAddFailureWithPendingException(executionUnitNotifier);
    verify(stepNotifier, times(0)).fireTestIgnored();
}
Also used : EachTestNotifier(org.junit.internal.runners.model.EachTestNotifier) PendingException(cucumber.api.PendingException) Result(gherkin.formatter.model.Result) Test(org.junit.Test)

Example 14 with EachTestNotifier

use of org.junit.internal.runners.model.EachTestNotifier in project cucumber-jvm by cucumber.

the class JUnitReporterTest method result_without_error_allow_stared_ignored.

@Test
public void result_without_error_allow_stared_ignored() {
    createAllowStartedIgnoredReporter();
    Result result = mock(Result.class);
    EachTestNotifier stepNotifier = mock(EachTestNotifier.class);
    jUnitReporter.stepNotifier = stepNotifier;
    jUnitReporter.result(result);
    verify(stepNotifier, times(0)).fireTestStarted();
    verify(stepNotifier).fireTestFinished();
    verify(stepNotifier, times(0)).addFailure(Matchers.<Throwable>any(Throwable.class));
    verify(stepNotifier, times(0)).fireTestIgnored();
}
Also used : EachTestNotifier(org.junit.internal.runners.model.EachTestNotifier) Result(gherkin.formatter.model.Result) Test(org.junit.Test)

Example 15 with EachTestNotifier

use of org.junit.internal.runners.model.EachTestNotifier in project cucumber-jvm by cucumber.

the class JUnitReporterTest method result_with_pending_step_non_strict.

@Test
public void result_with_pending_step_non_strict() {
    createNonStrictReporter();
    Result result = mock(Result.class);
    when(result.getError()).thenReturn(new PendingException());
    EachTestNotifier stepNotifier = mock(EachTestNotifier.class);
    jUnitReporter.stepNotifier = stepNotifier;
    jUnitReporter.result(result);
    verify(stepNotifier, times(0)).fireTestStarted();
    verify(stepNotifier, times(0)).fireTestFinished();
    verify(stepNotifier, times(0)).addFailure(Matchers.<Throwable>any(Throwable.class));
    verify(stepNotifier).fireTestIgnored();
}
Also used : EachTestNotifier(org.junit.internal.runners.model.EachTestNotifier) PendingException(cucumber.api.PendingException) Result(gherkin.formatter.model.Result) Test(org.junit.Test)

Aggregations

EachTestNotifier (org.junit.internal.runners.model.EachTestNotifier)30 AssumptionViolatedException (org.junit.internal.AssumptionViolatedException)12 Test (org.junit.Test)10 Result (gherkin.formatter.model.Result)8 Description (org.junit.runner.Description)6 PendingException (cucumber.api.PendingException)5 StoppedByUserException (org.junit.runner.notification.StoppedByUserException)5 Statement (org.junit.runners.model.Statement)4 Match (gherkin.formatter.model.Match)3 Ignore (org.junit.Ignore)2 Trace (com.navercorp.pinpoint.bootstrap.context.Trace)1 TraceContext (com.navercorp.pinpoint.bootstrap.context.TraceContext)1 Step (gherkin.formatter.model.Step)1 ArrayList (java.util.ArrayList)1 JSONException (org.json.JSONException)1 MultipleFailureException (org.junit.internal.runners.model.MultipleFailureException)1 InitializationError (org.junit.runners.model.InitializationError)1 KieSession (org.kie.api.runtime.KieSession)1 FactHandle (org.kie.api.runtime.rule.FactHandle)1 ProviderDescription (org.mapstruct.itest.testutil.runner.xml.Toolchains.ProviderDescription)1