Package org.jbehave.core.mock

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


        Mock listener = mock(BehaviourListener.class);
        Behaviour behaviour = new BehaviourClass(
                ClassWithDeeplyNestedClasses.class, new BehaviourVerifier((BehaviourListener) listener));
       
        // expect
        listener.expects("gotResult").with(successfulResultFromMethodCalled("shouldDoSomething1"));
        listener.expects("gotResult").with(successfulResultFromMethodCalled("shouldDoSomething2"));
       
        // when
        behaviour.verifyTo((BehaviourListener) listener);
       
View Full Code Here


        Behaviour behaviour = new BehaviourClass(
                ClassWithDeeplyNestedClasses.class, new BehaviourVerifier((BehaviourListener) listener));
       
        // expect
        listener.expects("gotResult").with(successfulResultFromMethodCalled("shouldDoSomething1"));
        listener.expects("gotResult").with(successfulResultFromMethodCalled("shouldDoSomething2"));
       
        // when
        behaviour.verifyTo((BehaviourListener) listener);
       
        // then
View Full Code Here

        // given
        Mock listener = mock(BehaviourListener.class);
        Behaviour behaviour = new BehaviourClass(HasNoBehaviourMethods.class, nullVerifier);
       
        // expect
        listener.expects("gotResult").never();
       
        // when
        behaviour.verifyTo((BehaviourListener) listener);
       
        // then
View Full Code Here

        // given
        Mock listener = mock(BehaviourListener.class);
        Behaviour behaviour = new BehaviourClass(HasNonPublicBehaviourMethod.class, nullVerifier);
       
        // expect
        listener.expects("gotResult").never();
       
        // when
        behaviour.verifyTo((BehaviourListener) listener);
       
        // then
View Full Code Here

        AScenario scenario = new AScenario();
        ScenarioResult result = new ScenarioResult("a scenario", "a story", Result.SUCCEEDED);
       
        scenario.expects("run").with(world);
        scenario.expects("containsMocks").will(returnValue(false));
        listener.expects("gotResult").with(eq(result));
       
        story.addScenario((Scenario)scenario);
        story.addListener((BehaviourListener)listener);
        story.run();
       
View Full Code Here

        AScenario scenario = new AScenario();
        ScenarioResult result = new ScenarioResult("a scenario", "a story", ScenarioResult.USED_MOCKS);

        scenario.expects("run").with(world);
        scenario.expects("containsMocks").will(returnValue(true));
        listener.expects("gotResult").with(eq(result));
       
        story.addScenario((Scenario)scenario);
        story.addListener((BehaviourListener)listener);
       
        story.run();
View Full Code Here

        Mock listener = mock(BehaviourListener.class);
        AScenario scenario = new AScenario();
        NestedVerificationException nve = new NestedVerificationException(new RuntimeException());
        ScenarioResult result = new ScenarioResult("a scenario", "a story", nve);
        scenario.expects("run").with(world).will(throwException(nve));
        listener.expects("gotResult").with(eq(result));
       
        story.addScenario((Scenario)scenario);
        story.addListener((BehaviourListener)listener);
       
        story.run();
View Full Code Here

        Mock given = mock(Given.class);
        GivenStep step = new GivenStep((Given)given);
        World world = new HashMapWorld();
       
        // expect
        given.expects("setUp").with(world);
       
        // when
        step.perform(world);
       
        // 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.