Examples of MByHaveSpec


Examples of org.moresbycoffee.mbyhave8.MByHaveSpec

        assertTrue("The and step execution should execute the step implementation and change the visited flag", visited.get());
    }

    @Test
    public void implementationLess_and_step_should_return_pending_state() {
        final Step step = new MByHaveSpec() {
            Step innerStep = and("Implementationless Step");
        }.innerStep;

        final StepOutput stepOutput = step.execute(DummyStepHooks.DUMMY);
View Full Code Here

Examples of org.moresbycoffee.mbyhave8.MByHaveSpec

    @Test
    public void spec_execution_should_invoke_callback_methods_in_order() {
        final MByHave8Hooks hooks = Mockito.mock(MByHave8Hooks.class);
        final InOrder inOrder = Mockito.inOrder(hooks);

        final MByHaveSpec spec = new MByHaveSpec() {{
            Feature("Test Feature1", Scenario("Scenario 1"));
        }};

        spec.registerHooks(hooks);

        spec.execute();

        inOrder.verify(hooks).startSpecification(Matchers.notNull(Specification.class));
        inOrder.verify(hooks).startFeature(Matchers.notNull(Feature.class));
        inOrder.verify(hooks).endFeature(Matchers.notNull(Feature.class), Matchers.eq(FeatureResult.Pending));
        inOrder.verify(hooks).endSpecification(Matchers.notNull(Specification.class), Matchers.notNull(SpecOutput.class));
View Full Code Here

Examples of org.moresbycoffee.mbyhave8.MByHaveSpec

    @Test
    public void feature_start_callback_should_be_invoked_when_Feature_execution_starts() {
        final MByHave8Hooks hooks = Mockito.mock(MByHave8Hooks.class);
        final InOrder inOrder = Mockito.inOrder(hooks);

        final MByHaveSpec spec = new MByHaveSpec() {{
            Feature("Test Feature1", Scenario("Scenario 1"));
        }};

        spec.registerHooks(hooks);

        spec.execute();

        inOrder.verify(hooks).startFeature(Matchers.notNull(Feature.class));
        inOrder.verify(hooks).endFeature(Matchers.notNull(Feature.class), Matchers.eq(FeatureResult.Pending));

    }
View Full Code Here

Examples of org.moresbycoffee.mbyhave8.MByHaveSpec

    @Test
    public void feature_start_callback_should_not_be_invoked_when_Feature_is_empty() {
        final MByHave8Hooks hooks = Mockito.mock(MByHave8Hooks.class);

        final MByHaveSpec spec = new MByHaveSpec() {{
            Feature("Test Feature1");
        }};

        spec.registerHooks(hooks);

        spec.execute();

        verify(hooks, never()).startFeature(Matchers.notNull(Feature.class));
        verify(hooks, never()).endFeature(Matchers.notNull(Feature.class), Matchers.eq(FeatureResult.Pending));

    }
View Full Code Here

Examples of org.moresbycoffee.mbyhave8.MByHaveSpec

    @Test
    public void each_feature_start_callback_should_be_invoked_when_Feature_execution_starts() {
        final MByHave8Hooks hooks = Mockito.mock(MByHave8Hooks.class);
        final InOrder inOrder = Mockito.inOrder(hooks);

        final MByHaveSpec spec = new MByHaveSpec() {{
            Feature("Test Feature1", Scenario("Scenario 1"));
            Feature("Test Feature2", Scenario("Scenario 2"));
        }};

        spec.registerHooks(hooks);

        spec.execute();

        final ArgumentCaptor<Feature> featureCaptor = ArgumentCaptor.forClass(Feature.class);
        inOrder.verify(hooks).startFeature(featureCaptor.capture());
        inOrder.verify(hooks).endFeature(Matchers.eq(featureCaptor.getValue()), Matchers.eq(FeatureResult.Pending));
        inOrder.verify(hooks).startFeature(Matchers.notNull(Feature.class));
View Full Code Here

Examples of org.moresbycoffee.mbyhave8.MByHaveSpec

    @Test
    public void scenario_callbacks_should_be_invoked_when_scenarios_are_executed() {
        final MByHave8Hooks hooks = Mockito.mock(MByHave8Hooks.class);
        final InOrder inOrder = Mockito.inOrder(hooks);

        final MByHaveSpec spec = new MByHaveSpec() {{
            Feature("Test Feature1",
                    Scenario("Scenario1"),
                    Scenario("Scenario2"));
        }};

        spec.registerHooks(hooks);

        spec.execute();


        final ArgumentCaptor<Feature> featureCaptor = ArgumentCaptor.forClass(Feature.class);
        inOrder.verify(hooks).startFeature(featureCaptor.capture());
        assertNotNull(featureCaptor.getValue());
View Full Code Here

Examples of org.moresbycoffee.mbyhave8.MByHaveSpec

    @Test
    public void step_callbacks_should_be_invoked_when_steps_are_executed() {
        final MByHave8Hooks hooks = Mockito.mock(MByHave8Hooks.class);
        final InOrder inOrder = Mockito.inOrder(hooks);

        final MByHaveSpec spec = new MByHaveSpec() {{
            Feature("Test Feature1",
                    Scenario("Scenario1",
                        given("initial state", () -> {}),
                        when("something happens", () -> {}),
                        then("we get this state", () -> {})
                    )
            );
        }};

        spec.registerHooks(hooks);
        spec.execute();


        final ArgumentCaptor<Feature> featureCaptor = ArgumentCaptor.forClass(Feature.class);
        inOrder.verify(hooks).startFeature(featureCaptor.capture());
        assertNotNull(featureCaptor.getValue());
View Full Code Here

Examples of org.moresbycoffee.mbyhave8.MByHaveSpec

@ExtensionMethod({ThrowableExtensions.class})
public class AnsiWriterReporterTest {

    @Test
    public void should_report_a_successful_feature_in_all_green() {
        final MByHaveSpec spec = new MByHaveSpec() {{
            Feature("this is a feature without runner",
                    Scenario("this is a scenario",
                            given("something", () -> {})));
        }};
        final SpecOutput output = spec.execute();


        final String reportOutput = report(output);

        assertEquals(ansi().fg(GREEN).a("Feature: this is a feature without runner").reset().newline().
View Full Code Here

Examples of org.moresbycoffee.mbyhave8.MByHaveSpec

            }
        });
        modules.addAll(userModules);

        final Injector injector = Guice.createInjector(modules);
        final MByHaveSpec testInstance; //(MByHaveSpec) testClass.newInstance();
        try {
            testInstance = injector.getInstance(MByHaveSpec.class);
            testInstance.registerHooks(guiceHooks);
        } catch (final RuntimeException | Error e) {
            log.log(Level.SEVERE, "Couldn't create specification instance");
            log.log(Level.SEVERE, "Couldn't create specification instance", e);
            throw e;
        }
View Full Code Here

Examples of org.moresbycoffee.mbyhave8.MByHaveSpec

        assertThat(stepOutput.getException(), notNullValue());
    }

    @Test
    public void implementationLess_given_step_should_return_pending_state() {
        final Step step = new MByHaveSpec() {
            Step innerStep = given("Implementationless Step");
        }.innerStep;

        final StepOutput stepOutput = step.execute(DummyStepHooks.DUMMY);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.