Package org.jmock

Examples of org.jmock.Mock.expects()


    Mock mockCommand2 = mock(Command.class);
    Command command2 = (Command) mockCommand2.proxy();
   
    mockCommand.expects(once()).method("run");
    mockCommand2.expects(once()).method("run");
    mockCommand2.expects(once()).method("undo");
   
    commandProcessor.execute(command);
    commandProcessor.execute(command2);
    commandProcessor.undo();
    assertTrue(commandProcessor.canRedo());
View Full Code Here


   
    // create class
    Mock mockClass = mock(ClassElement.class);
    mockFactory.expects(once()).method("createClass")
      .will(returnValue(mockClass.proxy()));
    mockClass.expects(once()).method("setOrigin");
    handler.setElementType(ElementType.CLASS);
    handler.mousePressed((EditorMouseEvent) mockEvent.proxy());

    // create package
    Mock mockPackage = mock(PackageElement.class);
View Full Code Here

    // create package
    Mock mockPackage = mock(PackageElement.class);
    mockFactory.expects(once()).method("createPackage")
      .will(returnValue(mockPackage.proxy()));
    mockPackage.expects(once()).method("setOrigin");
    handler.setElementType(ElementType.PACKAGE);
    handler.mousePressed((EditorMouseEvent) mockEvent.proxy());

    // create component
    Mock mockComponent = mock(ComponentElement.class);
View Full Code Here

    // create component
    Mock mockComponent = mock(ComponentElement.class);
    mockFactory.expects(once()).method("createComponent")
      .will(returnValue(mockComponent.proxy()));
    mockComponent.expects(once()).method("setOrigin");
    handler.setElementType(ElementType.COMPONENT);
    handler.mousePressed((EditorMouseEvent) mockEvent.proxy());

    // create note
    Mock mockNote = mock(NoteElement.class);
View Full Code Here

    // create note
    Mock mockNote = mock(NoteElement.class);
    mockFactory.expects(once()).method("createNote")
      .will(returnValue(mockNote.proxy()));
    mockNote.expects(once()).method("setOrigin");
    handler.setElementType(ElementType.NOTE);
    handler.mousePressed((EditorMouseEvent) mockEvent.proxy());
  }
}
View Full Code Here

    assertEquals(source, assoc.getElement1());
    assertEquals(target, assoc.getElement2());
   
    // toString()
    mockSource.expects(once()).method("getName").will(returnValue("source"));
    mockTarget.expects(once()).method("getName").will(returnValue("target"));
    assertEquals("source->target", assoc.toString());
   
    // name overrides toString()
    assoc.setName("association");
    assertEquals("association", assoc.toString());
View Full Code Here

    assertEquals(bounds, connection.getAbsoluteBounds());

    assertNotNull(connection.toString());
    Mock mockRelation = mock(Relation.class);
    connection.setRelation((Relation) mockRelation.proxy());
    mockRelation.expects(once()).method("toString")
      .will(returnValue("relation"));
    assertEquals("relation", connection.toString());
   
    mockConnection.expects(once()).method("isVisible").with(eq(bounds))
      .will(returnValue(true));
View Full Code Here

  /**
   * Tests the draw() operation, four handles are drawn.
   */
  public void testDraw() {
    Mock mockDrawingContext = mock(DrawingContext.class);
    mockDrawingContext.expects(exactly(4)).method("fillRectangle");
    selection.draw((DrawingContext) mockDrawingContext.proxy());
  }
 
  /**
   * Fixture for standard drag operations.
View Full Code Here

    assertTrue(selection.isDragging());
    // move it a little too far to the left
    Mock mockDiagram = mock(Diagram.class);
    mockOperations.expects(atLeastOnce()).method("getDiagram").
      will(returnValue(mockDiagram.proxy()));
    mockDiagram.expects(atLeastOnce()).method("getOrigin").
      will(returnValue(origin));
    mockDiagram.expects(atLeastOnce()).method("snap");
    selection.updatePosition(-10.0, 10.0);
    // and draw it, the selection is within the bounds
    Constraint[] params = {eq(0.0), eq(5.0), eq(320.0), eq(420.0), NULL};
View Full Code Here

    Mock mockDiagram = mock(Diagram.class);
    mockOperations.expects(atLeastOnce()).method("getDiagram").
      will(returnValue(mockDiagram.proxy()));
    mockDiagram.expects(atLeastOnce()).method("getOrigin").
      will(returnValue(origin));
    mockDiagram.expects(atLeastOnce()).method("snap");
    selection.updatePosition(-10.0, 10.0);
    // and draw it, the selection is within the bounds
    Constraint[] params = {eq(0.0), eq(5.0), eq(320.0), eq(420.0), NULL};
    mockDrawingContext.expects(once()).method("drawRectangle").
      with(params);
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.