本文整理汇总了Java中org.jbehave.core.model.Meta.EMPTY属性的典型用法代码示例。如果您正苦于以下问题:Java Meta.EMPTY属性的具体用法?Java Meta.EMPTY怎么用?Java Meta.EMPTY使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.jbehave.core.model.Meta
的用法示例。
在下文中一共展示了Meta.EMPTY属性的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: shouldNotRunStoriesNotAllowedByFilterOnStoryElement
@Test
public void shouldNotRunStoriesNotAllowedByFilterOnStoryElement() throws Throwable {
// Given
StoryReporter reporter = mock(ConcurrentStoryReporter.class);
StepCollector collector = mock(StepCollector.class);
FailureStrategy strategy = mock(FailureStrategy.class);
CandidateSteps mySteps = new Steps();
when(collector.collectScenarioSteps(eq(asList(mySteps)), (Scenario) anyObject(), eq(parameters))).thenReturn(
Arrays.<Step>asList());
Story story = new Story("excluded_path", Description.EMPTY, Meta.EMPTY, Narrative.EMPTY, asList(new Scenario()));
boolean givenStory = false;
givenStoryWithNoBeforeOrAfterSteps(story, givenStory, collector, mySteps);
String filterAsString = "-story_path excluded_path";
MetaFilter filter = new MetaFilter(filterAsString);
// When
StoryRunner runner = new StoryRunner();
Configuration configuration = configurationWith(reporter, collector, strategy);
configuration.storyControls().useStoryMetaPrefix("story_");
runner.run(configuration, asList(mySteps), story, filter);
// Then
verify(reporter).beforeStory(story, givenStory);
verify(reporter).storyNotAllowed(story, filterAsString);
verify(reporter).afterStory(givenStory);
}
示例2: shouldNotRunScenariosNotAllowedByFilter
@Test
public void shouldNotRunScenariosNotAllowedByFilter() throws Throwable {
// Given
StoryReporter reporter = mock(ConcurrentStoryReporter.class);
StepCollector collector = mock(StepCollector.class);
FailureStrategy strategy = mock(FailureStrategy.class);
CandidateSteps mySteps = new Steps();
when(collector.collectScenarioSteps(eq(asList(mySteps)), (Scenario) anyObject(), eq(parameters))).thenReturn(
Arrays.<Step>asList());
Meta meta = new Meta(asList("some property"));
Story story = new Story("", Description.EMPTY, Meta.EMPTY, Narrative.EMPTY, asList(new Scenario("", meta, GivenStories.EMPTY, ExamplesTable.EMPTY, asList(""))));
boolean givenStory = false;
givenStoryWithNoBeforeOrAfterSteps(story, givenStory, collector, mySteps);
String filterAsString = "-some property";
MetaFilter filter = new MetaFilter(filterAsString);
// When
StoryRunner runner = new StoryRunner();
runner.run(configurationWith(reporter, collector, strategy), asList(mySteps), story, filter);
// Then
verify(reporter).beforeStory(story, givenStory);
verify(reporter).beforeScenario("");
verify(reporter).scenarioNotAllowed(story.getScenarios().get(0), filterAsString);
verify(reporter).afterScenario();
}
示例3: parameterMeta
private Meta parameterMeta(Keywords keywords,
Map<String, String> scenarioParameters) {
String meta = keywords.meta();
if (scenarioParameters.containsKey(meta)) {
return Meta.createMeta(scenarioParameters.get(meta), keywords);
}
return Meta.EMPTY;
}
示例4: parseStoryMetaFrom
private Meta parseStoryMetaFrom(String storyAsText) {
Matcher findingMeta = patternToPullStoryMetaIntoGroupOne().matcher(preScenarioText(storyAsText));
if (findingMeta.matches()) {
String meta = findingMeta.group(1).trim();
return Meta.createMeta(meta, keywords);
}
return Meta.EMPTY;
}
示例5: findScenarioMeta
private Meta findScenarioMeta(String scenarioAsText) {
Matcher findingMeta = patternToPullScenarioMetaIntoGroupOne().matcher(scenarioAsText);
if (findingMeta.matches()) {
String meta = findingMeta.group(1).trim();
return Meta.createMeta(meta, keywords);
}
return Meta.EMPTY;
}
示例6: shouldRunScenarioWithExamplesTable
@Test
public void shouldRunScenarioWithExamplesTable() throws Throwable {
// Given
ExamplesTable examplesTable = new ExamplesTable("|one|two|\n|1|2|\n");
Map<String, String> tableRow = examplesTable.getRow(0);
Scenario scenario1 = new Scenario("my title 1", Meta.EMPTY, GivenStories.EMPTY, examplesTable, asList("step <one>",
"step <two>"));
Story story = new Story(new Description("my blurb"), Narrative.EMPTY, asList(scenario1));
Step step = mock(Step.class);
StepResult result = mock(StepResult.class);
when(step.perform(null)).thenReturn(result);
StoryReporter reporter = mock(ConcurrentStoryReporter.class);
StepCollector collector = mock(StepCollector.class);
FailureStrategy failureStrategy = mock(FailureStrategy.class);
Configuration configuration = configurationWith(reporter, collector, failureStrategy);
configuration.storyControls().doDryRun(true);
CandidateSteps mySteps = new Steps(configuration);
Step firstStep = mockSuccessfulStep("step <one>");
Step secondStep = mockSuccessfulStep("step <two>");
when(collector.collectScenarioSteps(asList(mySteps), scenario1,tableRow)).thenReturn(
asList(firstStep, secondStep));
boolean givenStory = false;
givenStoryWithNoBeforeOrAfterSteps(story, givenStory, collector, mySteps);
// When
StoryRunner runner = new StoryRunner();
runner.run(configuration, asList(mySteps), story);
// Then
InOrder inOrder = inOrder(reporter, failureStrategy);
inOrder.verify(reporter).beforeStory(story, givenStory);
inOrder.verify(reporter).beforeScenario("my title 1");
inOrder.verify(reporter).successful("step <one>");
inOrder.verify(reporter).successful("step <two>");
inOrder.verify(reporter).afterScenario();
inOrder.verify(reporter).afterStory(givenStory);
}
示例7: shouldNotRunScenariosNotAllowedByFilterOnScenarioElement
@Test
public void shouldNotRunScenariosNotAllowedByFilterOnScenarioElement() throws Throwable {
// Given
StoryReporter reporter = mock(ConcurrentStoryReporter.class);
StepCollector collector = mock(StepCollector.class);
FailureStrategy strategy = mock(FailureStrategy.class);
CandidateSteps mySteps = new Steps();
when(collector.collectScenarioSteps(eq(asList(mySteps)), (Scenario) anyObject(), eq(parameters))).thenReturn(
Arrays.<Step>asList());
Story story = new Story("", Description.EMPTY, Meta.EMPTY, Narrative.EMPTY, asList(new Scenario("excluded_title", Meta.EMPTY, GivenStories.EMPTY, ExamplesTable.EMPTY, asList(""))));
boolean givenStory = false;
givenStoryWithNoBeforeOrAfterSteps(story, givenStory, collector, mySteps);
String filterAsString = "-scenario_title excluded_title";
MetaFilter filter = new MetaFilter(filterAsString);
// When
StoryRunner runner = new StoryRunner();
Configuration configuration = configurationWith(reporter, collector, strategy);
configuration.storyControls().useScenarioMetaPrefix("scenario_");
runner.run(configuration, asList(mySteps), story, filter);
// Then
verify(reporter).beforeStory(story, givenStory);
verify(reporter).beforeScenario("excluded_title");
verify(reporter).scenarioNotAllowed(story.getScenarios().get(0), filterAsString);
verify(reporter).afterScenario();
}
示例8: shouldRunGivenStoriesAtStoryAndScenarioLevel
@Test
public void shouldRunGivenStoriesAtStoryAndScenarioLevel() throws Throwable {
// Given
GivenStories storyGivenStories = new GivenStories("/path/to/given/story1");
GivenStories scenarioGivenStories = new GivenStories("/path/to/given/story1");
Scenario scenario1 = new Scenario("scenario 1", asList("successfulStep"));
Scenario scenario2 = new Scenario("scenario 2", Meta.EMPTY, scenarioGivenStories, ExamplesTable.EMPTY,
asList("anotherSuccessfulStep"));
Story story1 = new Story(new Description("story 1"), Narrative.EMPTY, asList(scenario1));
Story story2 = new Story("", new Description("story 2"), Meta.EMPTY, Narrative.EMPTY, storyGivenStories, asList(scenario2));
Step step = mock(Step.class);
StepResult result = mock(StepResult.class);
when(step.perform(null)).thenReturn(result);
StoryParser storyParser = mock(StoryParser.class);
StoryLoader storyLoader = mock(StoryLoader.class);
StoryReporter reporter = mock(ConcurrentStoryReporter.class);
StepCollector collector = mock(StepCollector.class);
CandidateSteps mySteps = new Steps();
Step successfulStep = mockSuccessfulStep("successfulStep");
Step anotherSuccessfulStep = mockSuccessfulStep("anotherSuccessfulStep");
boolean givenStory = false;
givenStoryWithNoBeforeOrAfterSteps(story1, givenStory, collector, mySteps);
when(collector.collectScenarioSteps(asList(mySteps), scenario1, parameters)).thenReturn(asList(successfulStep));
givenStoryWithNoBeforeOrAfterSteps(story2, givenStory, collector, mySteps);
when(collector.collectScenarioSteps(asList(mySteps), scenario2, parameters)).thenReturn(
asList(anotherSuccessfulStep));
when(storyLoader.loadStoryAsText("/path/to/given/story1")).thenReturn("storyContent");
when(storyParser.parseStory("storyContent", "/path/to/given/story1")).thenReturn(story1);
givenStoryWithNoBeforeOrAfterSteps(story1, givenStory, collector, mySteps);
givenStoryWithNoBeforeOrAfterSteps(story2, givenStory, collector, mySteps);
FailureStrategy failureStrategy = mock(FailureStrategy.class);
// When
StoryRunner runner = new StoryRunner();
Configuration configuration = configurationWith(storyParser, storyLoader, reporter, collector, failureStrategy);
runner.run(configuration, asList(mySteps), story2);
// Then
InOrder inOrder = inOrder(reporter);
inOrder.verify(reporter).beforeStory(story2, givenStory);
inOrder.verify(reporter).givenStories(storyGivenStories);
inOrder.verify(reporter).givenStories(scenarioGivenStories);
inOrder.verify(reporter).successful("successfulStep");
inOrder.verify(reporter).successful("anotherSuccessfulStep");
inOrder.verify(reporter).afterStory(givenStory);
verify(reporter, never()).beforeStory(story1, givenStory);
}
示例9: shouldAllowToSkipBeforeAndAfterScenarioStepsIfGivenStory
@Test
public void shouldAllowToSkipBeforeAndAfterScenarioStepsIfGivenStory() throws Throwable {
// Given
Scenario scenario1 = new Scenario("scenario 1", asList("successfulStep"));
GivenStories givenStories = new GivenStories("/path/to/given/story1");
Scenario scenario2 = new Scenario("scenario 2", Meta.EMPTY, givenStories, ExamplesTable.EMPTY,
asList("anotherSuccessfulStep"));
Story story1 = new Story(new Description("story 1"), Narrative.EMPTY, asList(scenario1));
Story story2 = new Story(new Description("story 2"), Narrative.EMPTY, asList(scenario2));
Step step = mock(Step.class);
StepResult result = mock(StepResult.class);
when(step.perform(null)).thenReturn(result);
StoryParser storyParser = mock(StoryParser.class);
StoryLoader storyLoader = mock(StoryLoader.class);
StoryReporter reporter = mock(ConcurrentStoryReporter.class);
StepCollector collector = mock(StepCollector.class);
CandidateSteps mySteps = new Steps();
Step successfulStep = mockSuccessfulStep("successfulStep");
Step anotherSuccessfulStep = mockSuccessfulStep("anotherSuccessfulStep");
givenStoryWithNoBeforeOrAfterSteps(story1, false, collector, mySteps);
when(collector.collectScenarioSteps(asList(mySteps), scenario1, parameters)).thenReturn(asList(successfulStep));
givenStoryWithNoBeforeOrAfterSteps(story2, true, collector, mySteps);
when(collector.collectScenarioSteps(asList(mySteps), scenario2, parameters)).thenReturn(
asList(anotherSuccessfulStep));
when(storyLoader.loadStoryAsText("/path/to/given/story1")).thenReturn("storyContent");
when(storyParser.parseStory("storyContent", "/path/to/given/story1")).thenReturn(story1);
FailureStrategy failureStrategy = mock(FailureStrategy.class);
Step beforeStep = mockSuccessfulStep("SuccessfulBeforeScenarioStep");
Step afterStep = mockSuccessfulStep("SuccessfulAfterScenarioStep");
when(collector.collectBeforeOrAfterScenarioSteps(eq(asList(mySteps)), Matchers.<Meta>any(), eq(Stage.BEFORE), eq(ScenarioType.NORMAL))).thenReturn(asList(beforeStep));
when(collector.collectBeforeOrAfterScenarioSteps(eq(asList(mySteps)), Matchers.<Meta>any(), eq(Stage.AFTER), eq(ScenarioType.NORMAL))).thenReturn(asList(afterStep));
// When
StoryRunner runner = new StoryRunner();
Configuration configuration = configurationWith(storyParser, storyLoader, reporter, collector, failureStrategy);
configuration.storyControls().doSkipBeforeAndAfterScenarioStepsIfGivenStory(true);
runner.run(configuration, asList(mySteps), story2);
// Then
verify(collector).collectScenarioSteps(asList(mySteps), scenario1, parameters);
verify(collector).collectScenarioSteps(asList(mySteps), scenario2, parameters);
InOrder inOrder = inOrder(beforeStep, successfulStep, anotherSuccessfulStep, afterStep);
inOrder.verify(beforeStep).perform(null);
inOrder.verify(successfulStep).perform(null);
inOrder.verify(anotherSuccessfulStep).perform(null);
inOrder.verify(afterStep).perform(null);
}