Hi,

I've been using the osgi-mocks v. 1.2 to do unit test on stuff in my
bundles, and I've run into AbstractMethodError for stuff I've used.  It
took me some time to figure out why this was, but then I found that
MockBundleContext and MockBundle were compiled against an OSGi version
where the methods I was calling was missing from the interfaces.

Stuff that was missing, was:
 - The generic BundleContext.registerService, ie.
    
https://osgi.org/javadoc/r4v43/core/org/osgi/framework/BundleContext.html#registerService(java.lang.Class,
 S, java.util.Dictionary)
 - The BundleWiring API, which I use to get the classLoader, right now
   the test fails with AbstractMethodError in Bundle.adapt when I try
   using it to get a BundleWiring 
    
https://osgi.org/javadoc/r4v43/core/org/osgi/framework/Bundle.html#adapt(java.lang.Class)

Here's the code line that currently fails for me:
    BundleWiring bundleWiring = bundle.adapt(BundleWiring.class);

Are there plans to update osgi-mock to the newest OSGi version?

Speaking for myself I can live without the generics, but it would be
nice to be able to use a non-deprecated way of finding the classLoader.

I looked into subclassing and adding methods, but that wasn't easy.

(So I guess for now I'm back to mockito and creating by own mocks, even
if there will be an updated osgi-mock, it won't be here tomorrow).

Reply via email to