Search in sources :

Example 1 with FailingUponPendingStep

use of org.jbehave.core.failures.FailingUponPendingStep in project jbehave-core by jbehave.

the class EmbedderBehaviour method shouldFailWhenGeneratingReportsViewWithPendingSteps.

@Test(expected = RunningStoriesFailed.class)
public void shouldFailWhenGeneratingReportsViewWithPendingSteps() throws Throwable {
    // Given
    PerformableTree performableTree = mock(PerformableTree.class);
    EmbedderControls embedderControls = new EmbedderControls().doGenerateViewAfterStories(false);
    OutputStream out = new ByteArrayOutputStream();
    EmbedderMonitor monitor = new PrintStreamEmbedderMonitor(new PrintStream(out));
    ViewGenerator viewGenerator = mock(ViewGenerator.class);
    Embedder embedder = embedderWith(performableTree, embedderControls, monitor);
    embedder.configuration().useViewGenerator(viewGenerator).usePendingStepStrategy(new FailingUponPendingStep());
    File outputDirectory = new File("target/output");
    List<String> formats = asList("html");
    Properties viewResources = new Properties();
    when(viewGenerator.getReportsCount()).thenReturn(new ReportsCount(2, 0, 1, 2, 0, 0, 1, 0));
    embedder.generateReportsView(outputDirectory, formats, viewResources);
    // Then
    verify(viewGenerator).generateReportsView(outputDirectory, formats, viewResources);
    assertThatReportsViewGenerated(out);
}
Also used : PrintStream(java.io.PrintStream) ViewGenerator(org.jbehave.core.reporters.ViewGenerator) ByteArrayOutputStream(java.io.ByteArrayOutputStream) OutputStream(java.io.OutputStream) InjectableEmbedder(org.jbehave.core.InjectableEmbedder) UsingEmbedder(org.jbehave.core.annotations.UsingEmbedder) ByteArrayOutputStream(java.io.ByteArrayOutputStream) Matchers.containsString(org.hamcrest.Matchers.containsString) Properties(java.util.Properties) ReportsCount(org.jbehave.core.reporters.ReportsCount) FailingUponPendingStep(org.jbehave.core.failures.FailingUponPendingStep) File(java.io.File) Test(org.junit.Test)

Aggregations

ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 File (java.io.File)1 OutputStream (java.io.OutputStream)1 PrintStream (java.io.PrintStream)1 Properties (java.util.Properties)1 Matchers.containsString (org.hamcrest.Matchers.containsString)1 InjectableEmbedder (org.jbehave.core.InjectableEmbedder)1 UsingEmbedder (org.jbehave.core.annotations.UsingEmbedder)1 FailingUponPendingStep (org.jbehave.core.failures.FailingUponPendingStep)1 ReportsCount (org.jbehave.core.reporters.ReportsCount)1 ViewGenerator (org.jbehave.core.reporters.ViewGenerator)1 Test (org.junit.Test)1