Package org.jbehave.core.steps

Examples of org.jbehave.core.steps.ParameterConverters$ExamplesTableConverter


      .useStoryReporterBuilder(new StoryReporterBuilder()
            .withCodeLocation(CodeLocations.codeLocationFromClass(embedderClass))
            .withDefaultFormats()
        .withFormats(CONSOLE, TXT, HTML, XML)
        .withCrossReference(new CrossReference()))
            .useParameterConverters(new ParameterConverters()
                  .addConverters(new DateConverter(new SimpleDateFormat("yyyy-MM-dd")))) // use custom date pattern
            .useStepPatternParser(new RegexPrefixCapturingPatternParser(
              "%")) // use '%' instead of '$' to identify parameters
      .useStepMonitor(new SilentStepMonitor());               
  }
View Full Code Here


        Class<? extends Embeddable> embeddableClass = this.getClass();
        Properties viewResources = new Properties();
        viewResources.put("decorateNonHtml", "true");
        viewResources.put("reports", "ftl/jbehave-reports-with-totals.ftl");
        // Start from default ParameterConverters instance
        ParameterConverters parameterConverters = new ParameterConverters();
        // factory to allow parameter conversion and loading from external
        // resources (used by StoryParser too)
        ExamplesTableFactory examplesTableFactory = new ExamplesTableFactory(new LocalizedKeywords(),
                new LoadFromClasspath(embeddableClass), parameterConverters, new TableTransformers());
        // add custom converters
        parameterConverters.addConverters(new DateConverter(new SimpleDateFormat("yyyy-MM-dd")),
                new ExamplesTableConverter(examplesTableFactory));
    return new MostUsefulConfiguration()           
                .useStoryLoader(new LoadFromClasspath(embeddableClass))
                .useStoryParser(new RegexStoryParser(examplesTableFactory))
                .useStoryReporterBuilder(
View Full Code Here

    public Configuration configuration() {
        Class<? extends Embeddable> embeddableClass = this.getClass();
        Properties viewResources = new Properties();
        viewResources.put("decorateNonHtml", "true");
        // Start from default ParameterConverters instance
        ParameterConverters parameterConverters = new ParameterConverters();
        // factory to allow parameter conversion and loading from external
        // resources (used by StoryParser too)
        ExamplesTableFactory examplesTableFactory = new ExamplesTableFactory(new LocalizedKeywords(),
                new LoadFromClasspath(embeddableClass), parameterConverters, new TableTransformers());
        // add custom converters
        parameterConverters.addConverters(new DateConverter(new SimpleDateFormat("yyyy-MM-dd")),
                new ExamplesTableConverter(examplesTableFactory));

        return new MostUsefulConfiguration()
                .useStoryControls(new StoryControls().doDryRun(false).doSkipScenariosAfterFailure(false))
                .useStoryLoader(new LoadFromClasspath(embeddableClass))
View Full Code Here

    @Override
    public Configuration configuration() {
        Class<? extends Embeddable> embeddableClass = this.getClass();
        // Start from default ParameterConverters instance
        ParameterConverters parameterConverters = new ParameterConverters();
        // factory to allow parameter conversion and loading from external resources (used by StoryParser too)
        ExamplesTableFactory examplesTableFactory = new ExamplesTableFactory(new LocalizedKeywords(), new LoadFromClasspath(embeddableClass), parameterConverters);
        // add custom converters
        parameterConverters.addConverters(new DateConverter(new SimpleDateFormat("yyyy-MM-dd")),
                new ExamplesTableConverter(examplesTableFactory));
        return new MostUsefulConfiguration()
            .useStoryLoader(new LoadFromClasspath(embeddableClass))
            .useStoryParser(new RegexStoryParser(examplesTableFactory))
            .useStoryReporterBuilder(new StoryReporterBuilder()
View Full Code Here

    }

    @Test
    public void shouldConvertParameterValuesOfTableRow() throws Exception {
        // Given
        ParameterConverters parameterConverters = new ParameterConverters();
        parameterConverters.addConverters(new MethodReturningConverter(methodFor("convertDate"), this));
        ExamplesTableFactory factory = new ExamplesTableFactory(parameterConverters);

        // When
        String tableAsString = "|one|two|\n|11|22|\n|1/1/2010|2/2/2010|";
        ExamplesTable examplesTable = factory.createExamplesTable(tableAsString);
View Full Code Here

    }

    @Test
    public void shouldConvertParameterValuesOfTableRowWithDefaults() throws Exception {
        // Given
        ParameterConverters parameterConverters = new ParameterConverters();
        parameterConverters.addConverters(new MethodReturningConverter(methodFor("convertDate"), this));
        ExamplesTableFactory factory = new ExamplesTableFactory(parameterConverters);

        // When
        String tableDefaultsAsString = "|three|\n|99|";
        ExamplesTable defaultsTable = factory.createExamplesTable(tableDefaultsAsString);
View Full Code Here

    }

    @Test
    public void shouldThrowExceptionIfValuesOrRowsAreNotFound() throws Exception {
        // Given
        ParameterConverters parameterConverters = new ParameterConverters();
        ExamplesTableFactory factory = new ExamplesTableFactory(parameterConverters);

        // When
        String tableAsString = "|one|two|\n|11|22|\n";
        ExamplesTable examplesTable = factory.createExamplesTable(tableAsString);
View Full Code Here

    }

    @Test
    public void shouldAllowAdditionAndModificationOfRowValues() throws Exception {
        // Given
        ParameterConverters parameterConverters = new ParameterConverters();
        ExamplesTableFactory factory = new ExamplesTableFactory(parameterConverters);

        // When
        String tableAsString = "|one|two|\n|11|12|\n|21|22|";
        ExamplesTable examplesTable = factory.createExamplesTable(tableAsString);
View Full Code Here

    }

    @Test
    public void shouldAllowBuildingOfTableFromContent() throws Exception {
        // Given
        ParameterConverters parameterConverters = new ParameterConverters();
        ExamplesTableFactory factory = new ExamplesTableFactory(parameterConverters);

        // When
        String tableAsString = "|one|two|\n|11|12|\n|21|22|";
        ExamplesTable originalTable = factory.createExamplesTable(tableAsString);
View Full Code Here

    }

    @Test
    public void shouldAllowOutputToPrintStream() throws Exception {
        // Given
        ParameterConverters parameterConverters = new ParameterConverters();
        ExamplesTableFactory factory = new ExamplesTableFactory(parameterConverters);

        // When
        String tableAsString = "|one|two|\n|11|12|\n|21|22|\n";
        ExamplesTable table = factory.createExamplesTable(tableAsString);
View Full Code Here

TOP

Related Classes of org.jbehave.core.steps.ParameterConverters$ExamplesTableConverter

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.