Package org.moresbycoffee.mbyhave8

Examples of org.moresbycoffee.mbyhave8.MByHaveSpec


public class Specification_isExecutableTest {

    @Test
    public void should_be_true_if_there_are_features_in_the_specification() {
        final Specification specification = specificationWith(featureWith(successScenario()));
        assertTrue(specification.isExecuteable(Filter.EMPTY_FILTER));
    }
View Full Code Here


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

    @Test
    public void empty_specification_should_be_executable() {
        final Specification specification = specificationWith();
        assertTrue(specification.isExecuteable(Filter.EMPTY_FILTER));
    }
View Full Code Here

        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

    @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.MByHaveSpec

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.