Package org.moresbycoffee.mbyhave8.result

Examples of org.moresbycoffee.mbyhave8.result.StepResult$Error


    @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


    @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

    @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

    @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

    @Test
    public void feature_with_one_scenario_and_one_PENDING_step_should_be_PENDING() {
        final MByHaveSpec spec = new MByHaveSpec() {{
            Feature("this is a pending feature",
                Scenario("this is a scenario",
                    given("something", (VoidStepImplementation) () -> { throw new PendingException(); })));
        }};

        final SpecOutput output = spec.execute();

        assertEquals(SpecResult.Pending, output.getResult());
View Full Code Here

                            given("something", () -> { })));


            Feature("this is a pending feature",
                    Scenario("this is a scenario",
                            given("something", (VoidStepImplementation) () -> { throw new PendingException(); })));
        }};

        final SpecOutput output = spec.execute();

        assertEquals(SpecResult.Pending, output.getResult());
View Full Code Here

    @Test
    public void before_spec_method_should_be_converted_to_hook() throws Throwable {
        HookTestSpec.beforeSpec.set(new AtomicBoolean(false));

        final HookTestSpec hookTestSpec = new HookTestSpec();
        final Method[] beforeSpecMethods = new Method[] { HookTestSpec.class.getDeclaredMethod("beforeSpecification", Specification.class) };
        final MByHave8Hooks hook = new HookAnnotations(beforeSpecMethods, null, null, null, null, null).toMByHaveHook(hookTestSpec);

        hook.startSpecification(mock(Specification.class));
View Full Code Here

    @Test
    public void after_spec_method_should_be_converted_to_hook() throws Exception {
        HookTestSpec.afterSpec.set(new AtomicBoolean(false));

        final HookTestSpec hookTestSpec = new HookTestSpec();
        final Method[] afterSpecMethods = new Method[] { HookTestSpec.class.getDeclaredMethod("afterSpecification", Specification.class, SpecOutput.class) };
        final MByHave8Hooks hook = new HookAnnotations(null, afterSpecMethods, null, null, null, null).toMByHaveHook(hookTestSpec);

        hook.endSpecification(mock(Specification.class), mock(SpecOutput.class));
View Full Code Here

    @Test
    public void before_feature_method_should_be_converted_to_hook() throws Exception {
        HookTestSpec.beforeFeature.set(new AtomicBoolean(false));

        final HookTestSpec hookTestSpec = new HookTestSpec();
        final Method[] beforeFeatureMethods = new Method[] { HookTestSpec.class.getDeclaredMethod("beforeFeature", Feature.class) };
        final MByHave8Hooks hook = new HookAnnotations(null, null, beforeFeatureMethods, null, null, null).toMByHaveHook(hookTestSpec);

        hook.startFeature(mock(Feature.class));
View Full Code Here

    @Test
    public void after_feature_method_should_be_converted_to_hook() throws Exception {
        HookTestSpec.afterFeature.set(new AtomicBoolean(false));

        final HookTestSpec hookTestSpec = new HookTestSpec();
        final Method[] afterFeatureMethods = new Method[] { HookTestSpec.class.getDeclaredMethod("afterFeature", Feature.class, FeatureResult.class) };
        final MByHave8Hooks hook = new HookAnnotations(null, null, null, afterFeatureMethods, null, null).toMByHaveHook(hookTestSpec);

        hook.endFeature(mock(Feature.class), FeatureResult.Success);
View Full Code Here

TOP

Related Classes of org.moresbycoffee.mbyhave8.result.StepResult$Error

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.