[
https://issues.apache.org/jira/browse/SLING-4724?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14553864#comment-14553864
]
Roy Teeuwen commented on SLING-4724:
------------------------------------
Hmm, it seems to be an intellij problem. I created a test project to reproduce
the failure, but when I finished the test project and deleted the *.iml files
and .idea files and cleared the cache, the problem does not occur anymore...
(The problem happens when using the built in Run/Debug of Intellij on unit
tests). Any idea why maybe?
> Mock OSGI service does not work without bind and unbind methods.
> ----------------------------------------------------------------
>
> Key: SLING-4724
> URL: https://issues.apache.org/jira/browse/SLING-4724
> Project: Sling
> Issue Type: Bug
> Components: Testing
> Reporter: Roy Teeuwen
> Priority: Minor
> Labels: mocks
>
> When making a junit test using the org.apache.sling.testing.osgi-mock
> library, the osgi context will not start up (MockOsgi.injectServices(service,
> bundleContext) when a service which is @Reference'ed does not have a bind and
> unbind method. The following error is thrown:
> java.lang.RuntimeException: Bind method with name bindSecondService not found
> for reference 'secondService' for class {}some.packagename.FirstService
> at
> org.apache.sling.testing.mock.osgi.ReflectionServiceUtil.injectServiceReference(ReflectionServiceUtil.java:351)
> at
> org.apache.sling.testing.mock.osgi.ReflectionServiceUtil.injectServices(ReflectionServiceUtil.java:278)
> at
> org.apache.sling.testing.mock.osgi.MockOsgi.injectServices(MockOsgi.java:114)
> at some.packagename.FirstServiceTest.before(FirstServiceTest.java:42)
> Seeing as sling works without the bind methods, this looks to me like an
> error which should not happen and a default bind method should be used?
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)