Package org.jbehave.core.reporters.FilePrintStreamFactory

Examples of org.jbehave.core.reporters.FilePrintStreamFactory.FileConfiguration


    @Test
    public void shouldAllowOverrideOfDefaultConfiguration(){
        // Given
        URL codeLocation = CodeLocations.codeLocationFromClass(this.getClass());
        String storyPath = "org/jbehave/examples/trader/stories/my_given.story";
        FileConfiguration configuration = new FileConfiguration("ext");
       
        // When
        FilePrintStreamFactory factory = new FilePrintStreamFactory(new StoryLocation(codeLocation, storyPath), configuration);
        assertThat(factory.configuration(), equalTo(configuration));       
        FileConfiguration newConfiguration = new FileConfiguration();
        factory.useConfiguration(newConfiguration);
       
        // Then
        assertThat(factory.configuration(), not(equalTo(configuration)));       
        assertThat(factory.configuration().toString(), containsString(FileConfiguration.EXTENSION));       
View Full Code Here


    private void assertThatOutputNameIs(String storyPath, String outputName, FilePathResolver pathResolver) {
        // Given
        URL codeLocation = CodeLocations.codeLocationFromClass(this.getClass());
        String extension = "ext";       
        FileConfiguration configuration = (pathResolver != null ? new FileConfiguration("", extension, pathResolver) : new FileConfiguration(extension));
        // When
        FilePrintStreamFactory factory = new FilePrintStreamFactory(new StoryLocation(codeLocation, storyPath), configuration);
        // Then
        assertThat(factory.outputName(), equalTo(outputName));
    }
View Full Code Here

    @Test(expected=PrintStreamCreationFailed.class)
    public void shouldFailIfPrintStreamCannotBeCreated(){
        // Given
        URL codeLocation = CodeLocations.codeLocationFromClass(this.getClass());
        String storyPath = "org/jbehave/examples/trader/stories/my_given.story";
        FileConfiguration configuration = new FileConfiguration("ext");
        FilePrintStreamFactory factory = new FilePrintStreamFactory(new StoryLocation(codeLocation, storyPath), configuration){
            protected File outputDirectory() {
                return new File((String)null);
            }
        };
View Full Code Here

       
        // Then fail as expected
    }

    private void ensureOutputFileIsSame(URL codeLocation, String storyPath) {
        FileConfiguration configuration = new FileConfiguration("ext");
        FilePrintStreamFactory factory = new FilePrintStreamFactory(new StoryLocation(codeLocation, storyPath), configuration);
        factory.createPrintStream();
        File outputFile = factory.getOutputFile();
        String expected = new File(codeLocation.getFile()).getParent().replace('\\', '/') + "/" + configuration.getRelativeDirectory() + "/"
                + "org.jbehave.examples.trader.stories.my_given." + configuration.getExtension();
        assertThat(outputFile.toString().replace('\\', '/'), equalTo(expected));

    }
View Full Code Here

    private Keywords keywords;
    private CrossReference crossReference;
    private boolean multiThreading;
   
    public StoryReporterBuilder() {
      relativeDirectory = new FileConfiguration().getRelativeDirectory();
      pathResolver = new FileConfiguration().getPathResolver();
      codeLocation = CodeLocations.codeLocationFromPath("target/classes");
      viewResources = new FreemarkerViewGenerator().defaultViewProperties();
      keywords = new LocalizedKeywords();
    }
View Full Code Here

    protected FilePrintStreamFactory filePrintStreamFactory(String storyPath) {
        return new FilePrintStreamFactory(new StoryLocation(codeLocation, storyPath), fileConfiguration(""));
    }

    public FileConfiguration fileConfiguration(String extension) {
        return new FileConfiguration(relativeDirectory, extension, pathResolver);
    }
View Full Code Here

       
        boolean reportFailureTrace = true;
        builder.setReportFailureTrace(reportFailureTrace);
        assertThat(builder.isReportFailureTrace(), equalTo(reportFailureTrace));
       
        FilePathResolver pathResolver = new FileConfiguration().getPathResolver();
        builder.setPathResolver(pathResolver);
        assertThat(builder.getPathResolver(), equalTo(pathResolver));
    }
View Full Code Here

    protected FilePrintStreamFactory filePrintStreamFactory(String storyPath) {
        return new FilePrintStreamFactory(new StoryLocation(codeLocation, storyPath), fileConfiguration(""));
    }

    protected FileConfiguration fileConfiguration(String extension) {
        return new FileConfiguration(relativeDirectory, extension, pathResolver);
    }
View Full Code Here

TOP

Related Classes of org.jbehave.core.reporters.FilePrintStreamFactory.FileConfiguration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.