OsgiServiceStaticInterceptorTest.java 文件源码

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

项目:gemini.blueprint 作者:
public void testInvocationWhenServiceNA() throws Throwable {
    // service n/a
    ServiceReference reference = new MockServiceReference() {
        public Bundle getBundle() {
            return null;
        }
    };

    interceptor = new ServiceStaticInterceptor(new MockBundleContext(), reference);

    Object target = new Object();
    Method m = target.getClass().getDeclaredMethod("hashCode", null);

    MethodInvocation invocation = new MockMethodInvocation(m);
    try {
        interceptor.invoke(invocation);
        fail("should have thrown exception");
    }
    catch (ServiceUnavailableException ex) {
        // expected
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号