use of org.jbehave.core.embedder.Embedder.EmbedderFailureStrategy in project jbehave-core by jbehave.
the class EmbedderBehaviour method shouldHandleFailuresAccordingToStrategy.
@Test
public void shouldHandleFailuresAccordingToStrategy() throws Throwable {
// Given
PerformableTree performableTree = mock(PerformableTree.class);
EmbedderControls embedderControls = new EmbedderControls();
OutputStream out = new ByteArrayOutputStream();
EmbedderMonitor monitor = new PrintStreamEmbedderMonitor(new PrintStream(out));
ViewGenerator viewGenerator = mock(ViewGenerator.class);
Embedder embedder = embedderWith(performableTree, embedderControls, monitor);
EmbedderFailureStrategy failureStategy = mock(EmbedderFailureStrategy.class);
embedder.useEmbedderFailureStrategy(failureStategy);
embedder.configuration().useViewGenerator(viewGenerator);
File outputDirectory = new File("target/output");
List<String> formats = asList("html");
Properties viewResources = new Properties();
// When
ReportsCount count = new ReportsCount(1, 0, 1, 2, 1, 1, 1, 1);
when(viewGenerator.getReportsCount()).thenReturn(count);
embedder.generateReportsView(outputDirectory, formats, viewResources);
// Then
verify(failureStategy).handleFailures(count);
}
Aggregations