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.
3738394041424344
public class Feature_isExecutableTest { @Test public void should_be_true_if_there_are_scenarios_in_the_feature() { final Feature feature = featureWith(successScenario()); assertTrue(feature.isExecutable(Filter.EMPTY_FILTER)); }
4344454647484950
assertTrue(feature.isExecutable(Filter.EMPTY_FILTER)); } @Test public void empty_feature_should_be_executable() { final Feature feature = featureWith(); assertTrue(feature.isExecutable(Filter.EMPTY_FILTER)); }
4950515253545556
assertTrue(feature.isExecutable(Filter.EMPTY_FILTER)); } @Test public void feature_with_only_filtered_out_scenarios_should_not_be_executable() { final Feature feature = featureWith(successScenario().tag("Broken")); assertFalse(feature.isExecutable(new Filter("~Broken"))); }
575859606162636465
private Specification specification = new Specification(); //TODO replace announcer private final CallbackAnnouncer eventAnnouncer = new CallbackAnnouncer(); protected final Feature Feature(final String description, final Scenario... scenarios) { final Feature feature = new Feature(description, scenarios); specification = specification.withAdditionalFeature(feature); return feature; }
115116117118119120121122123
assertThat(scenario.getTags(), contains("tag1", "MBH-1", "MBH-2")); } @Test public void should_add_tag_to_feature() { final Feature feature = featureWith(successScenario()); feature.tag("TEST TAG1"); assertThat(feature.getTags(), contains("TEST TAG1")); }
122123124125126127128129130
assertThat(feature.getTags(), contains("TEST TAG1")); } @Test public void should_add_all_tags_to_feature() { final Feature feature = featureWith(successScenario()); feature.tag("TEST TAG1").tag("TEST TAG2"); assertThat(feature.getTags(), contains("TEST TAG1", "TEST TAG2")); }
129130131132133134135136137
assertThat(feature.getTags(), contains("TEST TAG1", "TEST TAG2")); } @Test public void should_add_multiple_tags_to_feature() { final Feature feature = featureWith(successScenario()); feature.tag("TEST TAG1", "TEST TAG2"); assertThat(feature.getTags(), contains("TEST TAG1", "TEST TAG2")); }
136137138139140141142143144
assertThat(feature.getTags(), contains("TEST TAG1", "TEST TAG2")); } @Test public void should_trim_the_tags_on_feature() { final Feature feature = featureWith(successScenario()); feature.tag("tag1 ", " ", " tag2", "tag3", null); assertThat(feature.getTags(), contains("tag1", "tag2", "tag3")); }
143144145146147148149150151
assertThat(feature.getTags(), contains("tag1", "tag2", "tag3")); } @Test public void should_should_not_do_anything_with_null_tag_to_feature() { final Feature feature = featureWith(successScenario()); feature.tag(null); assertTrue(feature.getTags().isEmpty()); }
150151152153154155156157158
assertTrue(feature.getTags().isEmpty()); } @Test public void should_add_issue() { final Feature feature = featureWith(successScenario()); feature.issue("MBH-1"); assertThat(feature.getIssues(), contains("MBH-1")); }