Search in sources :

Example 6 with Match

use of gherkin.formatter.model.Match in project cucumber-jvm by cucumber.

the class JUnitReporterTest method failed_step_and_after_with_pending_exception_non_strict.

@Test
public void failed_step_and_after_with_pending_exception_non_strict() {
    createNonStrictReporter();
    createDefaultRunNotifier();
    Result stepResult = mock(Result.class);
    Throwable exception = mock(Throwable.class);
    when(stepResult.getError()).thenReturn(exception);
    Result hookResult = mock(Result.class);
    Match match = mock(Match.class);
    when(hookResult.getStatus()).thenReturn("Pending");
    when(hookResult.getError()).thenReturn(new PendingException());
    EachTestNotifier executionUnitNotifier = mock(EachTestNotifier.class);
    jUnitReporter.executionUnitNotifier = executionUnitNotifier;
    jUnitReporter.result(stepResult);
    jUnitReporter.after(match, hookResult);
    jUnitReporter.finishExecutionUnit();
    verify(executionUnitNotifier, times(0)).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 7 with Match

use of gherkin.formatter.model.Match in project cucumber-jvm by cucumber.

the class FeatureResultListenerTest method should_forward_calls_to_reporter_interface_methods.

@Test
public void should_forward_calls_to_reporter_interface_methods() throws Exception {
    Match match = mock(Match.class);
    Result result = mockPassedResult();
    String mimeType = "mimeType";
    byte[] data = new byte[] { 1 };
    String text = "text";
    Reporter reporter = mock(Reporter.class);
    FeatureResultListener resultListener = new FeatureResultListener(reporter, false);
    resultListener.before(match, result);
    resultListener.match(match);
    resultListener.embedding(mimeType, data);
    resultListener.write(text);
    resultListener.result(result);
    resultListener.after(match, result);
    verify(reporter).before(match, result);
    verify(reporter).match(match);
    verify(reporter).embedding(mimeType, data);
    verify(reporter).write(text);
    verify(reporter).result(result);
    verify(reporter).after(match, result);
}
Also used : Reporter(gherkin.formatter.Reporter) Match(gherkin.formatter.model.Match) Result(gherkin.formatter.model.Result) Test(org.testng.annotations.Test)

Aggregations

Match (gherkin.formatter.model.Match)7 Result (gherkin.formatter.model.Result)7 Test (org.junit.Test)5 PendingException (cucumber.api.PendingException)3 Reporter (gherkin.formatter.Reporter)3 EachTestNotifier (org.junit.internal.runners.model.EachTestNotifier)3 Scenario (gherkin.formatter.model.Scenario)2 Given (cucumber.api.java.en.Given)1 DocString (gherkin.formatter.model.DocString)1 Step (gherkin.formatter.model.Step)1 Tag (gherkin.formatter.model.Tag)1 RunNotifier (org.junit.runner.notification.RunNotifier)1 Test (org.testng.annotations.Test)1