Package org.moresbycoffee.mbyhave8.annotations

Examples of org.moresbycoffee.mbyhave8.annotations.HookAnnotations$InvokeMethodFunction


    public void after_scenario_method_should_be_converted_to_hook() throws Exception {
        HookTestSpec.afterScenario.set(new AtomicBoolean(false));

        final HookTestSpec hookTestSpec = new HookTestSpec();
        final Method[] afterScenarioMethods = new Method[] { HookTestSpec.class.getDeclaredMethod("afterScenario", Scenario.class, ScenarioResult.class) };
        final MByHave8Hooks hook = new HookAnnotations(null, null, null, null, null, afterScenarioMethods).toMByHaveHook(hookTestSpec);

        hook.endScenario("TEST_FEATURE_ID", mock(Scenario.class), ScenarioResult.Success);

        assertTrue(HookTestSpec.afterScenario.get().get());

    }
View Full Code Here


    @Test(expected = LifeCycleHookException.class)
    public void should_throw_exception_if_error_happens_in_hook_execution() throws Exception {

        final Method[] beforeScenarioMethods = new Method[] { HookExceptionTestSpec.class.getDeclaredMethod("beforeScenario") };
        final MByHave8Hooks hook = new HookAnnotations(null, null, null, null, beforeScenarioMethods, null).toMByHaveHook(new HookExceptionTestSpec());

        hook.startScenario("TEST_FEATURE_ID", mock(Scenario.class));
    }
View Full Code Here

*/
public class CallbackInvocationTest {

    @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"));
        }};
View Full Code Here

    }

    @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"));
        }};
View Full Code Here

    }

    @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");
        }};
View Full Code Here

*/
public class ScenarioCallbackInvocationTest {

    @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);
View Full Code Here

    @Test
    public void should_return_success_to_each_level() {

        final RunNotifier runNotifier = mock(RunNotifier.class);

        new MByHave8Runner(SimpleJunitCompatibleSpec.class).run(runNotifier);

        Description suiteDescription = Description.createSuiteDescription(SimpleJunitCompatibleSpec.class);
        verify(runNotifier).fireTestStarted(suiteDescription);
        verify(runNotifier).fireTestFinished(suiteDescription);
View Full Code Here

        outputWriter.flush();
        return output;
    }

    public final SpecOutput execute(final Writer writer) {
        return execute(new AnsiWriterReporter(writer));
    }
View Full Code Here

        ));
    }

    private String report(final SpecOutput output) {
        final StringWriter outputWriter = new StringWriter();
        final Reporter reporter = new AnsiWriterReporter(outputWriter);
        reporter.report(output);
        return outputWriter.toString();
    }
View Full Code Here

        assertEquals("Feature: Feature description", featureWith(successScenario()).execute(DummyHooks.DUMMY, Filter.EMPTY_FILTER).getDescription());
    }

    @Test
    public void feature_output_should_carry_the_underlying_scenario_outputs() {
        final FeatureOutput featureOutput = featureWith(successScenario()).execute(DummyHooks.DUMMY, Filter.EMPTY_FILTER);
        assertEquals(1, featureOutput.getScenarios().size());
        assertEquals(ScenarioResult.Success, featureOutput.getScenarios().iterator().next().getResult());
    }
View Full Code Here

TOP

Related Classes of org.moresbycoffee.mbyhave8.annotations.HookAnnotations$InvokeMethodFunction

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.