Examples of expects()


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

        Game game = new Game(new PseudoRandomGlyphFactory(42, 7, 2), heartbeat, 7, 2); // pit is only 2 deep!
      
        Mock gameListener = mock(GameListener.class);
        game.requestStartGame();
       
        gameListener.expects("reportGameStateChanged").with(GameState.RUNNING);
        gameListener.expects("reportGameStateChanged").with(GameState.OVER);
        game.addGameListener((GameListener) gameListener);
       
       
        heartbeat.beat(); // first glyph falls; cannot add second glyph as it overlaps
View Full Code Here

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

      
        Mock gameListener = mock(GameListener.class);
        game.requestStartGame();
       
        gameListener.expects("reportGameStateChanged").with(GameState.RUNNING);
        gameListener.expects("reportGameStateChanged").with(GameState.OVER);
        game.addGameListener((GameListener) gameListener);
       
       
        heartbeat.beat(); // first glyph falls; cannot add second glyph as it overlaps
       
View Full Code Here

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

       
        PseudoRandomGlyphFactory factory = new PseudoRandomGlyphFactory(42, 7, 13);
        LivingGlyph glyph = factory.nextGlyph(CollisionDetector.NULL, listenerSet);
        Junk junk = factory.createJunk(listenerSet);
       
        listener.expects("reportGlyphMovement").times(2); // once for junk change, once for glyph change
       
        junk.absorb(glyph);
    }

    private GlyphType nextGlyphType(PseudoRandomGlyphFactory factory) {
View Full Code Here

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

       
        JButton button = new JButton("Press Me!");
        button.setName("a.button");
       
        Mock actionListener = mock(ActionListener.class);
        actionListener.expects("actionPerformed");
       
        button.addActionListener((ActionListener)actionListener);       
       
        frame.getContentPane().add(button);
        frame.pack();
View Full Code Here

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

        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.expects()

                }
            };
            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(' ');
           
            verifyMocks();
View Full Code Here

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

        checkForHeadless();
        Mock miniMapMock = mock(QueuedMiniMap.class);
       
        WindowGrabber grabber = new WindowGrabber((QueuedMiniMap)miniMapMock);
       
        miniMapMock.expects("get").with(eq("frame.name"), eq(WindowGrabber.DEFAULT_WINDOW_TIMEOUT));
        grabber.getWindow("frame.name");
       
        verifyMocks();
        grabber.dispose();
    }
View Full Code Here

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

        Mock miniMapMock = mock(QueuedMiniMap.class);
        WindowGrabber grabber = new WindowGrabber((QueuedMiniMap)miniMapMock);
       
        JFrame frame = new JFrame();
        frame.setName("frame.name");
        miniMapMock.expects("put").with("frame.name", frame);
        frame.setVisible(true);
               
        miniMapMock.expects("remove").with("frame.name");
        frame.dispose();
        waitForIdle();
View Full Code Here

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

        JFrame frame = new JFrame();
        frame.setName("frame.name");
        miniMapMock.expects("put").with("frame.name", frame);
        frame.setVisible(true);
               
        miniMapMock.expects("remove").with("frame.name");
        frame.dispose();
        waitForIdle();
        verifyMocks();
        grabber.dispose();
    }
View Full Code Here

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

 
  public void shouldBeAbleToMockClasses() {
    Object expected = new Object();

    Mock mock = classMock.mock(HashMap.class);
    mock.expects("get").with(anything()).will(returnValue(expected));
   
    Object actual = ((HashMap)mock).get("some key");
    ensureThat(expected, eq(actual));
  }
 
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.