Package org.jmock

Examples of org.jmock.Mock.expects()


* @version $Revision: 1631 $
*/
public class LifecycleContainerBuilderTestCase extends MockObjectTestCase {
    public void testBuildContainerCreatesANewChildContainerAndStartsItButNotTheParent() {
        final Mock childStartable = mock(Startable.class);
        childStartable.expects(once()).method("start").withNoArguments();
        childStartable.expects(once()).method("stop").withNoArguments();

        ContainerComposer containerComposer = new ContainerComposer() {
            public void composeContainer(MutablePicoContainer container, Object assemblyScope) {
                container.registerComponentInstance(childStartable.proxy());
View Full Code Here


*/
public class LifecycleContainerBuilderTestCase extends MockObjectTestCase {
    public void testBuildContainerCreatesANewChildContainerAndStartsItButNotTheParent() {
        final Mock childStartable = mock(Startable.class);
        childStartable.expects(once()).method("start").withNoArguments();
        childStartable.expects(once()).method("stop").withNoArguments();

        ContainerComposer containerComposer = new ContainerComposer() {
            public void composeContainer(MutablePicoContainer container, Object assemblyScope) {
                container.registerComponentInstance(childStartable.proxy());
            }
View Full Code Here

    public void testFolderAddedShouldDeployApplication() {
        Mock folderMock = mock(FileObject.class);
        FileObject folder = (FileObject) folderMock.proxy();

        Mock deployerMock = mock(Deployer.class);
        deployerMock.expects(once())
                    .method("deploy")
                    .with(same(folder), isA(ClassLoader.class), ANYTHING)
                    .will(returnValue(null));
        Deployer deployer = (Deployer)deployerMock.proxy();
        DifferenceAnalysingFolderContentHandler handler = null;
View Full Code Here

   
    // expectations
    Mock mockNester = mock(CompositeNode.class);
    mockDiagram.expects(once()).method("getChildAt")
      .will(returnValue(mockNester.proxy()));
    mockNester.expects(once()).method("canNestElements")
      .will(returnValue(true));
    mockNester.expects(once()).method("getAbsoluteBounds")
      .will(returnValue(new Rectangle2D.Double(0, 0, 100, 100)));
    mockNode.expects(once()).method("recalculateSize");
    mockNode.expects(once()).method("getAbsoluteBounds")
View Full Code Here

    Mock mockNester = mock(CompositeNode.class);
    mockDiagram.expects(once()).method("getChildAt")
      .will(returnValue(mockNester.proxy()));
    mockNester.expects(once()).method("canNestElements")
      .will(returnValue(true));
    mockNester.expects(once()).method("getAbsoluteBounds")
      .will(returnValue(new Rectangle2D.Double(0, 0, 100, 100)));
    mockNode.expects(once()).method("recalculateSize");
    mockNode.expects(once()).method("getAbsoluteBounds")
      .will(returnValue(new Rectangle2D.Double(5, 5, 10, 10)));
    mockDrawingContext.expects(exactly(2)).method("drawRectangle");
View Full Code Here

    mockEditor.expects(atLeastOnce()).method("execute");
    mockNode.expects(atLeastOnce()).method("setParent")
      .with(eq(mockDiagram.proxy()));
    mockDiagram.expects(atLeastOnce()).method("getChildAt")
      .will(returnValue(mockNester.proxy()));
    mockNester.expects(once()).method("canNestElements")
      .will(returnValue(true));
    mockNester.expects(once()).method("getAbsoluteBounds")
      .will(returnValue(new Rectangle2D.Double(0, 0, 100, 100)));
   
    // create class
View Full Code Here

      .with(eq(mockDiagram.proxy()));
    mockDiagram.expects(atLeastOnce()).method("getChildAt")
      .will(returnValue(mockNester.proxy()));
    mockNester.expects(once()).method("canNestElements")
      .will(returnValue(true));
    mockNester.expects(once()).method("getAbsoluteBounds")
      .will(returnValue(new Rectangle2D.Double(0, 0, 100, 100)));
   
    // create class
    mockFactory.expects(once()).method("createNode")
      .will(returnValue(mockNode.proxy()));
View Full Code Here

    Mock mockListener = mock(UmlModelElementListener.class);
    UmlClass umlclass = UmlClass.getPrototype();
    UmlClass clonedClass = (UmlClass) UmlClass.getPrototype().clone();
    clonedClass.addModelElementListener((UmlModelElementListener)
      mockListener.proxy());
    mockListener.expects(once()).method("elementChanged").with(eq(clonedClass));
    clonedClass.setAbstract(true);
    assertTrue(clonedClass.isAbstract());
    assertFalse(umlclass.isAbstract());
  }
 
View Full Code Here

    UmlProperty method3 = (UmlProperty) UmlProperty.getPrototype().clone();
    methodList.add(method1);
    methodList.add(method2);
    methodList.add(method3);
   
    mockListener.expects(once()).method("elementChanged").with(eq(clonedClass));
    clonedClass.setMethods(methodList);
    assertEquals(methodList, clonedClass.getMethods());
  }

  /**
 
View Full Code Here

    UmlProperty attrib3 = (UmlProperty) UmlProperty.getPrototype().clone();
    attributeList.add(attrib1);
    attributeList.add(attrib2);
    attributeList.add(attrib3);
   
    mockListener.expects(once()).method("elementChanged").with(eq(clonedClass));
    clonedClass.setAttributes(attributeList);
    assertEquals(attributeList, clonedClass.getAttributes());
  }

  /**
 
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.