Package org.jbehave.core.mock

Examples of org.jbehave.core.mock.Mock.expects()


public class GivenScenarioBehaviour extends UsingMiniMock {
 
  public void shouldRunScenarioWithWorldWhenSetUp() throws Exception {
    Mock scenario = mock(Scenario.class);
        World world = (World) stub(World.class);
        scenario.expects("run").with(world);
               
        GivenScenario givenScenario = new GivenScenario((Scenario) scenario);
        givenScenario.setUp(world);
       
        verifyMocks();
View Full Code Here


  }
   
    public void shouldCleanUpScenarioWhenCleanedUp() {
        Mock scenario = mock(Scenario.class);
        World world = (World) stub(World.class);
        scenario.expects("cleanUp").with(world);
               
        GivenScenario givenScenario = new GivenScenario((Scenario) scenario);
        givenScenario.cleanUp(world);
       
        verifyMocks();
View Full Code Here

        Object instance = new HasSuccessfulMethod();
        Mock listener = mock(BehaviourListener.class);
        Behaviour behaviour = createBehaviourMethod(instance, "shouldWork");
       
        // expect...
        listener.expects("gotResult").with(resultOfType(Result.SUCCEEDED));
       
        // when...
        behaviour.verifyTo((BehaviourListener) listener);
       
        // then...
View Full Code Here

        // given
        Behaviour behaviour = createBehaviourMethod(new MethodThrowsException(), "shouldDoSomething");
        Mock listener = mock(BehaviourListener.class);
       
        // expect
        listener.expects("gotResult").with(resultContainingCheckedException());
       
        // when
        behaviour.verifyTo((BehaviourListener) listener);
       
        // then
View Full Code Here

        // given
        Behaviour behaviour = createBehaviourMethod(new SetUpThrowsException(), "shouldDoSomething");
        Mock listener = mock(BehaviourListener.class);
       
        // expect
        listener.expects("gotResult").with(resultContainingCheckedException());
       
        // when
        behaviour.verifyTo((BehaviourListener) listener);
       
        // then
View Full Code Here

        // 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

        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

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

        // 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

        // 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

TOP
Copyright © 2018 www.massapi.com. 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.