Package org.jmock.core.matcher

Examples of org.jmock.core.matcher.InvokeOnceMatcher


        // Test same remove but via entity
        windowAccess.removeWindow(window);             

        assertNotNull(windowAccess.getPortletWindow(f1));               
       
        windowListMock.expects(new InvokeOnceMatcher()).method("iterator").withNoArguments().will(new ReturnStub(windows.iterator()));

/*       
        windowAccess.removeWindows(entity); 
       
        windowAccess.getPortletWindow(f1);
View Full Code Here


*/
public class CreateSessionInterceptorTest extends StrutsTestCase {

    public void testCreateSession() throws Exception {
        Mock httpServletRequestMock = new Mock(HttpServletRequest.class);
        httpServletRequestMock.expects(new InvokeOnceMatcher()).method("getSession").with(new IsEqual(Boolean.TRUE));
        HttpServletRequest request = (HttpServletRequest) httpServletRequestMock.proxy();

        ServletActionContext.setRequest(request);

        CreateSessionInterceptor interceptor = new CreateSessionInterceptor();
View Full Code Here

*/
public class CreateSessionInterceptorTest extends StrutsTestCase {

    public void testCreateSession() throws Exception {
        Mock httpServletRequestMock = new Mock(HttpServletRequest.class);
        httpServletRequestMock.expects(new InvokeOnceMatcher()).method("getSession").with(new IsEqual(Boolean.TRUE));
        HttpServletRequest request = (HttpServletRequest) httpServletRequestMock.proxy();

        ServletActionContext.setRequest(request);

        CreateSessionInterceptor interceptor = new CreateSessionInterceptor();
View Full Code Here

    public Stub throwException( Throwable throwable ) {
        return new ThrowStub(throwable);
    }

    public InvocationMatcher once() {
        return new InvokeOnceMatcher();
    }
View Full Code Here

*/
public class CreateSessionInterceptorTest extends StrutsTestCase {

    public void testCreateSession() throws Exception {
        Mock httpServletRequestMock = new Mock(HttpServletRequest.class);
        httpServletRequestMock.expects(new InvokeOnceMatcher()).method("getSession").with(new IsEqual(Boolean.FALSE));
        httpServletRequestMock.expects(new InvokeOnceMatcher()).method("getSession").with(new IsEqual(Boolean.TRUE));
        httpServletRequestMock.expects(new InvokeOnceMatcher()).method("getSession").with(new IsEqual(Boolean.FALSE));
        HttpServletRequest request = (HttpServletRequest) httpServletRequestMock.proxy();

        ServletActionContext.setRequest(request);

        CreateSessionInterceptor interceptor = new CreateSessionInterceptor();
View Full Code Here

    }
   
    public void testEvents() throws Exception
    {
        Mock mockListener = new Mock(PersistenceStoreEventListener.class);
        mockListener.expects(new InvokeOnceMatcher()).method("afterMakePersistent").isVoid();
        mockListener.expects(new InvokeOnceMatcher()).method("beforeMakePersistent").isVoid();
        mockListener.expects(new InvokeOnceMatcher()).method("afterDeletePersistent").isVoid();
        mockListener.expects(new InvokeOnceMatcher()).method("beforeDeletePersistent").isVoid();
        PersistenceStoreEventListener listener =(PersistenceStoreEventListener) mockListener.proxy();
        store.addEventListener(listener);
       
       
        store.getTransaction().begin();
        A a = new A();
        a.setName("a1");
        store.makePersistent(a);
        store.getTransaction().commit();
       
        store.getTransaction().begin();
        store.deletePersistent(a);
        store.getTransaction().commit();
       
             
        mockListener.verify();
       
        mockListener.reset();
       
        mockListener.expects(new InvokeOnceMatcher()).method("afterMakePersistent").isVoid();
        mockListener.expects(new InvokeOnceMatcher()).method("beforeMakePersistent").isVoid();
        mockListener.expects(new InvokeOnceMatcher()).method("afterDeletePersistent").isVoid();
        mockListener.expects(new InvokeOnceMatcher()).method("beforeDeletePersistent").isVoid();
       
        PersistenceStore store2 = new PBStore("jetspeed");
        store2.getTransaction().begin();
        A a2 = new A();
View Full Code Here

        // Test same remove but via entity
        windowAccess.removeWindow(window);             
             
        assertNotNull(windowAccess.getPortletWindow(f1));               
       
        windowListMock.expects(new InvokeOnceMatcher()).method("iterator").withNoArguments().will(new ReturnStub(windows.iterator()));
       
        windowAccess.removeWindows(entity)
       
        windowAccess.getPortletWindow(f1);
        // Double that second call bypasses creating a new window
View Full Code Here

    public Stub throwException( Throwable throwable ) {
        return new ThrowStub(throwable);
    }

    public InvocationMatcher once() {
        return new InvokeOnceMatcher();
    }
View Full Code Here

        // Test same remove but via entity
        windowAccess.removeWindow(window);             
             
        assertNotNull(windowAccess.getPortletWindow(f1));               
       
        windowListMock.expects(new InvokeOnceMatcher()).method("iterator").withNoArguments().will(new ReturnStub(windows.iterator()));
       
        windowAccess.removeWindows(entity)
       
        windowAccess.getPortletWindow(f1);
        // Double that second call bypasses creating a new window
View Full Code Here

        // Test same remove but via entity
        windowAccess.removeWindow(window);             
             
        assertNotNull(windowAccess.getPortletWindow(f1));               
       
        windowListMock.expects(new InvokeOnceMatcher()).method("iterator").withNoArguments().will(new ReturnStub(windows.iterator()));
       
        windowAccess.removeWindows(entity)
       
        windowAccess.getPortletWindow(f1);
        // Double that second call bypasses creating a new window
View Full Code Here

TOP

Related Classes of org.jmock.core.matcher.InvokeOnceMatcher

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.