Package org.moresbycoffee.mbyhave8.structure

Examples of org.moresbycoffee.mbyhave8.structure.Specification$TriFunction


        assertTrue(specification.isExecuteable(Filter.EMPTY_FILTER));
    }

    @Test
    public void specification_with_only_filtered_out_features_should_not_be_executable() {
        final Specification specification = specificationWith(featureWith(successScenario()).tag("Broken"));
        assertFalse(specification.isExecuteable(new Filter("~Broken")));

    }
View Full Code Here


    public static Feature featureWith(final String name, final Scenario... scenarios) {
        return new Feature(name, scenarios);
    }

    public static Specification specificationWith(Feature... features) {
        return new Specification(features);
    }
View Full Code Here

    @Test
    public void should_generate_a_maindescription() {


        final Specification specification = specificationWith(featureWith(scenarioWith(successGivenStep())));
        final Description rootDescription = JUnitDescription.parse(specification, this.getClass()).getRootDescription();

        assertThat(rootDescription, notNullValue());
        assertEquals(this.getClass().getName(), rootDescription.getClassName());
        final Description featureDescription = ListExtensions.head(rootDescription.getChildren());
View Full Code Here

    @Test
    public void and_step_execution_should_run_the_step_implementation() {
        final AtomicBoolean visited = new AtomicBoolean(false);

        final Step andStep = new MByHaveSpec() {
            Step innerStep = and("an And step", () -> { visited.set(true); return StepResult.Success; });
        }.innerStep;

        final StepOutput result = andStep.execute(DummyStepHooks.DUMMY);

        assertEquals(StepResult.Success, result.getResult());
        assertTrue("The and step execution should execute the step implementation and change the visited flag", visited.get());
    }
View Full Code Here

    @Test
    public void and_step_implemenentation_can_be_either_void_return_method() {
        final AtomicBoolean visited = new AtomicBoolean(false);

        final Step andStep = new MByHaveSpec() {
            Step innerStep = and("an And step", () -> visited.set(true));
        }.innerStep;

        final StepOutput result = andStep.execute(DummyStepHooks.DUMMY);

        assertEquals(StepResult.Success, result.getResult());
        assertTrue("The and step execution should execute the step implementation and change the visited flag", visited.get());
    }
View Full Code Here

        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);

        assertEquals(StepResult.Pending, stepOutput.getResult());
    }
View Full Code Here

        return new Scenario(description, steps);
    }


    protected final Step given(final String description, final StepImplementation stepImplementation) {
        return new Step("Given", description, stepImplementation);
    }
View Full Code Here

    protected final Step given(final String description) {
        return given(description, (VoidStepImplementation) () -> { throw new PendingException("Step is not implemented yet."); });
    }

    protected final Step when(final String description, final StepImplementation stepImplementation) {
        return new Step("When", description, stepImplementation);
    }
View Full Code Here

    protected final Step when(final String description) {
        return when(description, (VoidStepImplementation) () -> { throw new PendingException("Step is not implemented yet."); });
    }

    protected final Step then(final String description, final StepImplementation stepImplementation) {
        return new Step("Then", description, stepImplementation);
    }
View Full Code Here

    protected final Step then(final String description) {
        return then(description, (VoidStepImplementation) () -> { throw new PendingException("Step is not implemented yet."); });
    }

    protected final Step and(final String description, final StepImplementation stepImplementation) {
        return new Step("And", description, stepImplementation);
    }
View Full Code Here

TOP

Related Classes of org.moresbycoffee.mbyhave8.structure.Specification$TriFunction

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.