good catch, you found a bug in sling-mock. i've opened https://issues.apache.org/jira/browse/SLING-6077 for this and will add a unit test to cover this case.
stefan >-----Original Message----- >From: Christoph Thodte [mailto:christoph.tho...@ht-solutions.de] >Sent: Tuesday, September 27, 2016 8:57 PM >To: users@sling.apache.org >Subject: Problems with testing using JCR_MOCK > >Hi! > >I have a problem with the Sling Mock Testing: > >Trying to use slick mock with resourcetyperesolver other like the default. >Changing to default it works. But an unsupportedoperation exception is >raised because I wan't to use queries. >JCR_MOCK and JCR_OAK doesn't work in this setup. The following exception is >raised > >org.apache.sling.testing.mock.osgi.ReferenceViolationException: Multiple >matches found for unary reference 'factory' for class >de.htsolutions.sling.testing.FormularService > >After debugging I find the the reason: There are two >ResourceResolverFactory instances in the context and the framework doesn't >know which to use. > >Problem in setup or bug or a thinking error by me? > >Here is a github repo with an example: >https://github.com/thodte/slingtesting > >-- >Mit freundlichen Grüßen >Christoph Thodte > >Mobil: +49 (0)174 2555201 >Office: +49 (0)34973 299945 > >E-Mail: christoph.tho...@ht-solutions.de<mailto:christoph.thodte@ht- >solutions.de> >Website: www.ht-solutions.de<http://www.ht-solutions.de/>