Examples of stubs()


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

* set balance = -50
*/
public class AccountIsOverdrawn extends GivenUsingMiniMock {
    public void setUp(World world) {
        Mock accountMock = (Mock)world.get("account", mock(Account.class));
        accountMock.stubs("getBalance").will(returnValue(-50));
    }

    public String getDescription() {
        return "set balance = -50";
    }
View Full Code Here

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

/** set overdraft limit = 0 */
public class AccountDoesNotHaveOverdraftFacility extends GivenUsingMiniMock {

    public void setUp(World world) {
        Mock account = (Mock) world.get("account", mock(Account.class));
        account.stubs("getOverdraftLimit").withNoArguments().will(returnValue(0));
    }

    public String getDescription() {
        return "set overdraft limit = 0";
    }
View Full Code Here

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

/** set balance = 50 */
public class AccountIsInCredit extends GivenUsingMiniMock {
   
    public void setUp(World world) {
        Mock account = (Mock) world.get("account", mock(Account.class));
        account.stubs("getBalance").withNoArguments().will(returnValue(50));
    }
}
View Full Code Here

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

/** set balance = 50 */
public class AccountHasPositiveBalance extends GivenUsingMiniMock {
   
    public void setUp(World world) {
        Mock account = (Mock) world.get("account", mock(Account.class));
        account.stubs("getBalance").withNoArguments().will(returnValue(50));
    }
}
View Full Code Here

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

        Game game = new Game(factory, heartbeat, 7, 13);
        game.addGlyphListener((GlyphListener) glyphListener);
       
        Segments initialSegments = GlyphType.T.getSegments(0).movedRight(3);
       
        glyphListener.stubs("reportGlyphMovement").with(eq(GlyphType.JUNK), anything(), anything());
        glyphListener.expects("reportGlyphMovement").with(eq(GlyphType.T), anything(), eq(initialSegments));
        glyphListener.expects("reportGlyphMovement").with(eq(GlyphType.T), eq(initialSegments), eq(initialSegments.movedDown()));
        game.requestStartGame();
        heartbeat.beat();
       
View Full Code Here

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

        PseudoRandomGlyphFactory factory = new PseudoRandomGlyphFactory(42, 7, 13); // T, Z, S, J...
        Mock glyphListener = mock(GlyphListener.class);
        Game game = new Game(factory, heartbeat, 7, 13);
        game.addGlyphListener((GlyphListener) glyphListener);
       
        glyphListener.stubs("reportGlyphMovement").never();
       
        heartbeat.beat();
        game.requestGlyphMovement(GlyphMovement.DOWN);
        game.requestGlyphMovement(GlyphMovement.LEFT);
        game.requestGlyphMovement(GlyphMovement.RIGHT);
View Full Code Here

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

/** set overdraft limit = 0 */
public class AccountDoesNotHaveOverdraftPermission extends GivenUsingMiniMock {

    public void setUp(World world) {
        Mock account = (Mock) world.get("account", mock(Account.class));
        account.stubs("getOverdraftLimit").withNoArguments().will(returnValue(0));
    }

    public String getDescription() {
        return "set overdraft limit = 0";
    }
View Full Code Here

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

   
        try {
            AFrame frame = new AFrame();           

            Mock action = mock(Action.class, "Action");
            action.stubs("isEnabled").will(returnValue(true));
            action.expects("actionPerformed").with(anything());
           
            frame.contentPanel.getActionMap().put(AFrame.ACTION_KEY, (Action) action);
           
            wrapper.pressKeychar(' ');
View Full Code Here

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

                    return ((KeyEvent)arg).getKeyCode() == KeyEvent.VK_SPACE ||
                        ((KeyEvent)arg).getKeyChar() == ' ';
                }
            };
            Mock keyListener = mock(KeyListener.class);
            keyListener.stubs("keyTyped").once().with(spaceKeyEvent);
            keyListener.stubs("keyPressed").once().with(spaceKeyEvent);
            keyListener.expects("keyReleased").once().with(spaceKeyEvent);
            frame.contentPanel.addKeyListener((KeyListener) keyListener);   
           
            wrapper.pressKeychar(' ');
View Full Code Here

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

                        ((KeyEvent)arg).getKeyChar() == ' ';
                }
            };
            Mock keyListener = mock(KeyListener.class);
            keyListener.stubs("keyTyped").once().with(spaceKeyEvent);
            keyListener.stubs("keyPressed").once().with(spaceKeyEvent);
            keyListener.expects("keyReleased").once().with(spaceKeyEvent);
            frame.contentPanel.addKeyListener((KeyListener) keyListener);   
           
            wrapper.pressKeychar(' ');
           
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.