MByHave8 specific callback announcer. This class maintains a list of hooks and it invokes them one-by-one when the given event happens.
The start hooks are invoked in the order as they were attached. The end hooks are invoked in a reverse order.
157158159160161162163164165
assertThat(feature.getIssues(), contains("MBH-1")); } @Test public void should_add_multiple_issues() { final Feature feature = featureWith(successScenario()); feature.issue("MBH-1", "MBH-2").issue("MBH-3"); assertThat(feature.getIssues(), contains("MBH-1", "MBH-2", "MBH-3")); }
164165166167168169170171172
assertThat(feature.getIssues(), contains("MBH-1", "MBH-2", "MBH-3")); } @Test public void should_handle_null_issue() { final Feature feature = featureWith(successScenario()); feature.issue(null); assertTrue(feature.getIssues().isEmpty()); }
171172173174175176177178179
assertTrue(feature.getIssues().isEmpty()); } @Test public void should_trim_the_issues() { final Feature feature = featureWith(successScenario()); feature.issue("MBH-1 ", " ", " MBH-2", "MBH-3", null); assertThat(feature.getIssues(), contains("MBH-1", "MBH-2", "MBH-3")); }
178179180181182183184185186
assertThat(feature.getIssues(), contains("MBH-1", "MBH-2", "MBH-3")); } @Test public void should_add_issues_to_tags_as_well_on_a_feature() { final Feature feature = featureWith(successScenario()); feature.tag("tag1").issue("MBH-1", "MBH-2"); assertThat(feature.getTags(), contains("tag1", "MBH-1", "MBH-2")); }
46474849505152535455565758
@Test public void the_secenario_callbacks_should_be_called_before_and_after_the_scenario() { final ScenarioHooks hooks = Mockito.mock(ScenarioHooks.class); final InOrder inOrder = Mockito.inOrder(hooks); final Scenario scenario = TestUtils.successScenario(); scenario.execute(hooks); final ArgumentCaptor<Scenario> scenarioCaptor = ArgumentCaptor.forClass(Scenario.class); inOrder.verify(hooks).startScenario(scenarioCaptor.capture()); inOrder.verify(hooks).endScenario(Mockito.eq(scenarioCaptor.getValue()), Mockito.eq(ScenarioResult.Success));
63646566676869
specification = specification.withAdditionalFeature(feature); return feature; } protected final Scenario Scenario(final String description, final Step... steps) { return new Scenario(description, steps); }
444546474849505152
@SuppressWarnings("all") public class AddTagTest { @Test public void should_add_tag_to_scenario() { final Scenario scenario = successScenario(); scenario.tag("TEST TAG1"); assertThat(scenario.getTags(), contains("TEST TAG1")); }
515253545556575859
assertThat(scenario.getTags(), contains("TEST TAG1")); } @Test public void should_add_all_tags_to_scenario() { final Scenario scenario = successScenario(); scenario.tag("TEST TAG1").tag("TEST TAG2"); assertThat(scenario.getTags(), contains("TEST TAG1", "TEST TAG2")); }
585960616263646566
assertThat(scenario.getTags(), contains("TEST TAG1", "TEST TAG2")); } @Test public void should_add_multiple_tags_to_scenario() { final Scenario scenario = successScenario(); scenario.tag("TEST TAG1", "TEST TAG2"); assertThat(scenario.getTags(), contains("TEST TAG1", "TEST TAG2")); }
656667686970717273
assertThat(scenario.getTags(), contains("TEST TAG1", "TEST TAG2")); } @Test public void should_trim_the_tags_on_scenarios() { final Scenario scenario = successScenario(); scenario.tag("tag1 ", " ", " tag2", "tag3", null); assertThat(scenario.getTags(), contains("tag1", "tag2", "tag3")); }