Search in sources :

Example 1 with FeatureAdvisor

use of org.ff4j.aop.FeatureAdvisor in project ff4j by ff4j.

the class InvalidParameter method testInvalidParameter.

@Test(expected = IllegalArgumentException.class)
public void testInvalidParameter() throws Throwable {
    final IDoIt service = new IDoItImpl();
    service.doIt("");
    FeatureAdvisor fa = new FeatureAdvisor();
    fa.setFf4j(new FF4j("test-ff4j-features.xml"));
    MethodInvocation mi = new MethodInvocation() {

        public Object proceed() throws Throwable {
            return null;
        }

        public Object getThis() {
            return service;
        }

        public AccessibleObject getStaticPart() {
            return null;
        }

        public Object[] getArguments() {
            return null;
        }

        public Method getMethod() {
            try {
                Method m = IDoIt.class.getMethod("doIt", String.class);
                return m;
            } catch (SecurityException e) {
                e.printStackTrace();
            } catch (NoSuchMethodException e) {
                e.printStackTrace();
            }
            return null;
        }
    };
    fa.invoke(mi);
}
Also used : FF4j(org.ff4j.FF4j) FeatureAdvisor(org.ff4j.aop.FeatureAdvisor) MethodInvocation(org.aopalliance.intercept.MethodInvocation) AccessibleObject(java.lang.reflect.AccessibleObject) Method(java.lang.reflect.Method) Test(org.junit.Test)

Aggregations

AccessibleObject (java.lang.reflect.AccessibleObject)1 Method (java.lang.reflect.Method)1 MethodInvocation (org.aopalliance.intercept.MethodInvocation)1 FF4j (org.ff4j.FF4j)1 FeatureAdvisor (org.ff4j.aop.FeatureAdvisor)1 Test (org.junit.Test)1