Package org.jbehave.core.model

Examples of org.jbehave.core.model.Meta


        StoryPathResolver resolver = configuration.storyPathResolver();
        State beforeStories = mock(State.class);
        when(runner.runBeforeOrAfterStories(configuration, candidateSteps, Stage.BEFORE)).thenReturn(beforeStories);
        List<String> storyPaths = new ArrayList<String>();
        Map<String, Story> stories = new HashMap<String, Story>();
        Meta meta = mock(Meta.class);
        for (Class<? extends Embeddable> embeddable : embeddables) {
            String storyPath = resolver.resolve(embeddable);
            storyPaths.add(storyPath);
            Story story = mockStory(Meta.EMPTY);
            when(story.getMeta()).thenReturn(meta);
View Full Code Here


        assertFilterAllowsProperty(null, "skip", true);
        assertFilterAllowsProperty("", "skip", true);
    }

    private void assertFilterAllowsProperty(String filter, String property, boolean allowed) {
        assertThat(filter(filter).allow(new Meta(asList(property))), equalTo(allowed));
    }
View Full Code Here

            meta.setProperty("d", val);
            return this;
        }

        public Meta build() {
            return new Meta(meta);
        }
View Full Code Here

        monitor.generatingReportsView(outputDirectory, formats, viewProperties);
        String storyPath = "path";
        List<String> metaFilters = asList("- skip");
        monitor.mappingStory(storyPath, metaFilters);
        monitor.mapsViewGenerationFailed(outputDirectory, storyMaps, viewProperties, cause);
        Meta meta = mock(Meta.class);
        MetaFilter filter = mock(MetaFilter.class);
        monitor.metaNotAllowed(meta, filter);
        monitor.navigatorViewGenerationFailed(outputDirectory, viewResources, cause);
        monitor.navigatorViewNotGenerated();
        Properties properties = mock(Properties.class);
View Full Code Here

    static void narrateAnInterestingStory(StoryReporter reporter,
            boolean withFailure) {
        Properties meta = new Properties();
        meta.setProperty("theme", "testing");
        meta.setProperty("author", "Mauro");
        Story story = new Story("/path/to/story", new Description("An interesting story"), new Meta(meta),
                new Narrative("renovate my house", "customer", "get a loan"), new ArrayList<Scenario>());
        boolean givenStory = false;
        reporter.beforeStory(story, givenStory);
        reporter.dryRun();
        reporter.narrative(story.getNarrative());
View Full Code Here

    static void narrateAnInterestingStoryNotAllowedByFilter(StoryReporter reporter, boolean storyNotAllowed) {
        Properties meta = new Properties();
        meta.setProperty("theme", "testing");
        meta.setProperty("author", "Mauro");
        Story story = new Story("/path/to/story",
                new Description("An interesting story"), new Meta(meta), new Narrative("renovate my house", "customer", "get a loan"),
                Arrays.asList(new Scenario("A scenario", new Meta(meta), GivenStories.EMPTY, ExamplesTable.EMPTY, new ArrayList<String>())));
        reporter.beforeStory(story, false);
        if (storyNotAllowed) {
            reporter.storyNotAllowed(story, "-theme testing");
        } else  {
            reporter.beforeScenario(story.getScenarios().get(0).getTitle());
View Full Code Here

    }

    public void beforeStory(Story story, boolean givenStory) {
        print(format("beforeStory", "{0}\n({1})\n", story.getDescription().asString(), story.getPath()));
        if (!story.getMeta().isEmpty()) {
            Meta meta = story.getMeta();
            print(meta);
        }
    }
View Full Code Here

public class StoryMapperBehaviour {

    @Test
    public void shouldMapStoriesAllowedByFilter() throws Throwable {
        // Given
        Meta meta1 = mock(Meta.class, "meta1");
        Story story1 = new Story("/path/to/story1", Description.EMPTY, meta1, Narrative.EMPTY, asList(new Scenario("scenario1", meta1)));
        Meta meta2 = mock(Meta.class, "meta2");
        Story story2 = new Story("/path/to/story2", Description.EMPTY, meta2, Narrative.EMPTY, asList(new Scenario("scenario2", meta2)));
        MetaFilter filter = mock(MetaFilter.class);
        String filterAsString = "-some property";
       
        // When
        StoryMapper mapper = new StoryMapper();
        when(meta1.inheritFrom(meta1)).thenReturn(meta1);
        when(meta2.inheritFrom(meta2)).thenReturn(meta2);
        when(filter.allow(meta1)).thenReturn(false);
        when(filter.allow(meta2)).thenReturn(true);
        when(filter.asString()).thenReturn(filterAsString);
        mapper.map(story1, filter);
        mapper.map(story2, filter);
View Full Code Here

                "Meta: @author Paul" + NL +
                "Given another step ";
        Story story = parser.parseStory(
                wholeStory, storyPath);
        assertThat(story.getPath(), equalTo(storyPath));
        Meta storyMeta = story.getMeta();
        assertThat(storyMeta.getProperty("theme"), equalTo("parsing"));
        assertThat(storyMeta.getProperty("skip"), equalTo(""));
        assertThat(storyMeta.getProperty("unknown"), equalTo(""));       
        assertThat(story.getGivenStories().getPaths(), equalTo(asList("path1", "path2")));
        List<Scenario> scenarios = story.getScenarios();
        assertThat(scenarios.get(0).getTitle(), equalTo("A scenario"));
        assertThat(scenarios.get(0).getMeta().getProperty("author"), equalTo("Mauro"));
        assertThat(scenarios.get(1).getTitle(), equalTo("Another scenario"));
View Full Code Here

                "When I parse it" + NL +
                "Then I should get steps";
        Story story = parser.parseStory(
                wholeStory, storyPath);
        assertThat(story.getPath(), equalTo(storyPath));
        Meta storyMeta = story.getMeta();
        assertThat(storyMeta.getProperty("theme"), equalTo("parsing"));
        assertThat(storyMeta.getProperty("skip"), equalTo(""));
        assertThat(story.getScenarios().get(0).getMeta().getProperty("authors"), equalTo("Mauro Paul"));
    }
View Full Code Here

TOP

Related Classes of org.jbehave.core.model.Meta

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.