Package org.jbehave.core.mock

Examples of org.jbehave.core.mock.Mock


        Ensure.that(mock instanceof Foo);
    }
   
    public void shouldCreateObjectWithInterfaceFromSystemClassLoader() throws Exception {
        // given
        Mock mock = MiniMockObject.mock(Comparable.class, "comparable");
       
        // verify
        Ensure.that(mock instanceof Comparable);
    }
View Full Code Here


        // verify
        Ensure.that(mock instanceof Comparable);
    }
   
    public void shouldSucceedWhenMethodCalledWithExpectedArgument() {
        Mock mock = MiniMockObject.mock(Foo.class, "foo");
       
        mock.expects("doSomething").with(eq("A"));
       
        ((Foo)mock).doSomething("A");
       
        try {
            mock.verify();
        } catch (VerificationException ve) {
            Ensure.that(false);
        }
    }
View Full Code Here

            Ensure.that(false);
        }
    }
   
    public void shouldFailOnVerifyWhenMethodCalledWithExpectedThenUnexpectedArgument() {
        Mock mock = MiniMockObject.mock(Foo.class, "foo");
       
        mock.expects("doSomething").with(eq("A"));
       
        ((Foo)mock).doSomething("A");
       
        boolean skippedThis = true;
       
View Full Code Here

    private String newLine() {
        return System.getProperty("line.separator");
    }

    public void shouldSucceedOnVerifyWhenMethodCalledWithExpectedArgumentThenOtherMethodCalled() {
        Mock mock = MiniMockObject.mock(Foo.class, "foo");
        mock.expects("doSomething");
       
        ((Foo)mock).doSomething();
        ((Foo)mock).doSomethingElse();
       
        mock.verify();
    }
View Full Code Here

        mock.verify();
    }
   
    public void shouldCreateStrictMockWithDefaultName() throws Exception {
        // given
        Mock strictMock = MiniMockObject.strictMock(Foo.class, "foo");
        Exception caughtException = null;
       
        // when
        try {
            ((Foo)strictMock).doSomething();
View Full Code Here

    public Mock mock(Class type) {
        return mock(type, mockName(type));
    }
   
    public Mock mock(Class type, String name) {
        Mock mock = createMock(type, name);
        mocks.add(mock);
        return mock;
    }
View Full Code Here

    public Mock strictMock(Class type) {
        return strictMock(type, mockName(type));
    }
   
    public Mock strictMock(Class type, String name) {
        Mock mock = MiniMockObject.strictMock(type, name);
        mocks.add(mock);
        return mock;
    }
View Full Code Here

 
  public void shouldContainTheButtonToStartTheGame() throws Exception {

    WindowWrapper wrapper = new DefaultWindowWrapper("TestFrame");
   
    Mock gameStarter = mock(GameRequestListener.class);
    gameStarter.expects("requestStartGame");
   
    FrontPanel panel = new FrontPanel((GameRequestListener)gameStarter);

    JFrame frame = new JFrame();
    frame.setName("TestFrame");
View Full Code Here

    public interface OutcomeWithCleanUp extends Outcome, CleansUpWorld {}
    public interface GivenWorld extends Given, CleansUpWorld, World {}
   
    public void shouldPerformGiven() throws Exception {
        // given
        final Mock given = mock(Given.class);
        Scenario scenario = new MultiStepScenario() {
            public void specifySteps() {
                given((Given) given);
            }
        };
        scenario.specify();
        World world = new HashMapWorld();
       
        // expect
        given.expects("setUp").with(world);
       
        // when
        scenario.run(world);
       
        // then
View Full Code Here

        verifyMocks();
    }
   
    public void shouldPerformEvent() throws Exception {
        // given
        final Mock event = mock(Event.class);
        Scenario scenario = new MultiStepScenario() {
            public void specifySteps() {
                when((Event)event);
            }
        };
        scenario.specify();
        World world = new HashMapWorld();
       
        // expect
        event.expects("occurIn").with(world);
       
        // when
        scenario.run(world);
       
        // 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.