EventHandlerTest.java 文件源码

java
阅读 20 收藏 0 点赞 0 评论 0

项目:cn1 作者:
/**
 * The test checks the method invoke() with null property name
 */
public void testInvokeWithNullPropertyName() throws Exception {
    InvocationObject invocationObject = new InvocationObject();

    EventHandler handler = new EventHandler(invocationObject,
            "doSomething", null, null);

    Object proxy = EventHandler.create(SampleListener.class,
            invocationObject, "doSomething");

    Method m = SampleListener.class.getMethod("fireSampleEvent",
            new Class[] { SampleEvent.class });
    handler.invoke(proxy, m, new Object[] { new SampleEvent("") });

    assertEquals(invocationObject, handler.getTarget());
    assertEquals("doSomething", getMethodName());

    // Regression test for HARMONY-4033
    m = FredListener.class.getMethod("fireFredEvent",
            new Class[] { FredEvent.class });
    proxy = EventHandler.create(FredListener.class, invocationObject,
            "doSomething", null, "fireFredEvent");
    m.invoke(proxy, new Object[] { null });
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号