Package org.jbehave.core.mock

Examples of org.jbehave.core.mock.Mock


    }
   
    public void shouldReportExceptionFromTearDown() throws Throwable {
        // given
        Behaviour behaviour = createBehaviourMethod(new TearDownThrowsException(), "shouldDoSomething");
        Mock listener = mock(BehaviourListener.class);
       
        // expect
        listener.expects("gotResult").with(resultContainingCheckedException());
       
        // when
        behaviour.verifyTo((BehaviourListener) listener);
       
        // then
View Full Code Here


    }
   
    public void shouldReportExceptionFromMethodIfMethodAndTearDownBothThrowException() throws Throwable {
        // given
        Behaviour behaviour = createBehaviourMethod(new MethodAndTearDownBothThrowException(), "shouldDoSomething");
        Mock listener = mock(BehaviourListener.class);
       
        // expect
        listener.expects("gotResult").with(resultContainingExceptionMessage("from method"));
       
        // when
        behaviour.verifyTo((BehaviourListener) listener);
       
        // then
View Full Code Here

        public void perform(World world) {}
    }
   
    public void shouldDelegateNarration() {
        // given
        Mock component = mock(ScenarioComponent.class);
        AbstractStep step = new StubbedAbstractStep((ScenarioComponent)component);
        Renderer renderer = (Renderer) stub(Renderer.class);
       
        // expect
        component.expects("narrateTo").with(renderer);
       
        // when
        step.narrateTo(renderer);
       
        // then
View Full Code Here

        verifyMocks();
    }

    public void shouldDelegateVerifyingMocks() {
        // given
        Mock component = mock(ScenarioComponent.class);
        AbstractStep step = new StubbedAbstractStep((ScenarioComponent)component);
       
        // expect
        component.expects("verifyMocks");
       
        // when
        step.verifyMocks();
       
        // then
View Full Code Here

        verifyMocks();
    }
   
    public void shouldDelegateContainsMocks() {
        // given
        Mock component = mock(ScenarioComponent.class);
        AbstractStep step = new StubbedAbstractStep((ScenarioComponent)component);
       
        // expect
        component.expects("containsMocks").will(returnValue(false));
       
        // when
        step.containsMocks();
       
        // then
View Full Code Here

   
    public interface ScenarioComponentWithCleanUp extends ScenarioComponent, CleansUpWorld {}
   
    public void shouldTellComponentWithCleanUpToCleanUpWorld() throws Exception {
        // given
        Mock component = mock(ScenarioComponentWithCleanUp.class);
        AbstractStep step = new StubbedAbstractStep((ScenarioComponent)component);
        World world = new HashMapWorld();
       
        // expect
        component.expects("cleanUp").with(world);
       
        // when
        step.cleanUp(world);
       
        // then
View Full Code Here

import org.jbehave.core.mock.Mock;

public class OutcomeStepBehaviour extends UsingMiniMock {
    public void shouldTellOutcomeToVerifyWorld() throws Exception {
        // given
        Mock outcome = mock(Outcome.class);
        AbstractStep step = new OutcomeStep((Outcome)outcome);
        World world = new HashMapWorld();
       
        // expect
        outcome.expects("verify").with(world);
       
        // when
        step.perform(world);
       
        // then
View Full Code Here

import org.jbehave.core.mock.Mock;

public class BehaviourVerifierBehaviour extends UsingMiniMock {
    public void shouldVerifyBehaviour() throws Exception {
        // given...
        Mock behaviour = mock(Behaviour.class);
        Mock listener = mock(BehaviourListener.class);
        BehaviourVerifier verifier = new BehaviourVerifier((BehaviourListener) listener);
       
        // expect...
        listener.expects("before").with(behaviour);
        behaviour.expects("verifyTo").with(verifier).after(listener, "before");
        listener.expects("after").with(behaviour).after(behaviour, "verifyTo");
       
        // when...
        verifier.verifyBehaviour((Behaviour)behaviour);
       
        // then...
View Full Code Here

import org.jbehave.core.mock.Mock;

public class EventStepBehaviour extends UsingMiniMock {
    public void shouldTellEventToOccurInWorld() throws Exception {
        // given
        Mock event = mock(Event.class);
        EventStep step = new EventStep((Event)event);
        World world = new HashMapWorld();
       
        // expect
        event.expects("occurIn").with(world);
       
        // when
        step.perform(world);
       
        // then
View Full Code Here

public class NarrativeBehaviour extends UsingMiniMock {

    public void shouldNarrateToRenderer() throws Exception {
        // given...
        Narrative narrative = new Narrative("role", "feature", "benefit");
        Mock renderer = mock(Renderer.class);
       
        // expect...
        renderer.expects("renderNarrative").with(narrative);

        // when...
        narrative.narrateTo((Renderer)renderer);
       
        // then...
View Full Code Here

TOP

Related Classes of org.jbehave.core.mock.Mock

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.