DynaopClassPointcutTestCase.java :  » Inversion-of-Control » nanocontainer » org » nanocontainer » aop » dynaop » Java Open Source

Java Open Source » Inversion of Control » nanocontainer 
nanocontainer » org » nanocontainer » aop » dynaop » DynaopClassPointcutTestCase.java
/*****************************************************************************
 * Copyright (c) PicoContainer Organization. All rights reserved.            *
 * ------------------------------------------------------------------------- *
 * The software in this package is published under the terms of the BSD      *
 * style license a copy of which has been included with this distribution in *
 * the LICENSE.txt file.                                                     *
 *                                                                           *
 * Idea by Rachel Davies, Original code by various                           *
 *****************************************************************************/
package org.nanocontainer.aop.dynaop;

import dynaop.ClassPointcut;
import org.jmock.Mock;
import org.jmock.MockObjectTestCase;

/**
 * @author Stephen Molitor
 */
public class DynaopClassPointcutTestCase extends MockObjectTestCase {

    private Mock mockDelegate = mock(dynaop.ClassPointcut.class);

    public void testPicks() {
        mockDelegate.expects(once()).method("picks").with(eq(String.class)).will(returnValue(false));
        mockDelegate.expects(once()).method("picks").with(eq(Integer.class)).will(returnValue(true));

        ClassPointcut pointcut = new DynaopClassPointcut((ClassPointcut) mockDelegate.proxy());
        assertFalse(pointcut.picks(String.class));
        assertTrue(pointcut.picks(Integer.class));
    }

}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.