use of gherkin.formatter.model.Result in project cucumber-jvm by cucumber.
the class FeatureResultListenerTest method mockPassedResult.
private Result mockPassedResult() {
Result result = mock(Result.class);
when(result.getStatus()).thenReturn(Result.PASSED);
return result;
}
use of gherkin.formatter.model.Result in project cucumber-jvm by cucumber.
the class FeatureResultListenerTest method mockPendingResult.
private Result mockPendingResult() {
Result result = mock(Result.class);
when(result.getStatus()).thenReturn(FeatureResultListener.PENDING_STATUS);
return result;
}
use of gherkin.formatter.model.Result 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);
}
use of gherkin.formatter.model.Result in project cucumber-jvm by cucumber.
the class FeatureResultListenerTest method should_collect_error_after_undefined.
@Test
public void should_collect_error_after_undefined() throws Exception {
Result result = mockFailedResult();
FeatureResultListener resultListener = new FeatureResultListener(mock(Reporter.class), true);
resultListener.result(Result.UNDEFINED);
resultListener.result(result);
assertEquals(resultListener.getFirstError(), result.getError());
}
use of gherkin.formatter.model.Result in project cucumber-jvm by cucumber.
the class FeatureResultListenerTest method should_collect_first_error.
@Test
public void should_collect_first_error() throws Exception {
Result result = mockFailedResult();
FeatureResultListener resultListener = new FeatureResultListener(mock(Reporter.class), false);
resultListener.result(result);
resultListener.result(mockFailedResult());
resultListener.result(mockPendingResult());
resultListener.result(Result.UNDEFINED);
assertEquals(resultListener.getFirstError(), result.getError());
}
Aggregations