Package org.nanocontainer.aop.dynaop

Source Code of org.nanocontainer.aop.dynaop.DynaopClassPointcutTestCase

/*****************************************************************************
* 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));
    }

}
TOP

Related Classes of org.nanocontainer.aop.dynaop.DynaopClassPointcutTestCase

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.