@Override
  public void setRootResources(final Map<String, ResourceModel> rootResources)
  {
    log.debug("Setting root resources");

    _rootResources = rootResources;

    Collection<Class<?>> allResourceClasses = new HashSet<>();
    for (ResourceModel resourceModel : _rootResources.values())
    {
      processChildResource(resourceModel, allResourceClasses);
    }

    _jsr330Adapter = new Jsr330Adapter(allResourceClasses, _beanProvider);
  }
@Test
  public void testAmbiguousBeanResolution() throws Exception
  {
    Map<String, ResourceModel> pathRootResourceMap =
      buildResourceModels(SomeResource1.class,
                          SomeResource2.class,
                          SomeResource4.class);

    // set up mock ApplicationContext
    BeanProvider ctx = EasyMock.createMock(BeanProvider.class);
    EasyMock.expect(ctx.getBean(EasyMock.eq("dep1"))).andReturn(new SomeDependency1()).anyTimes();

    Map<String, SomeDependency2> map2 = new HashMap<>();
    map2.put("someBeanName", new SomeDependency2());
    EasyMock.expect(ctx.getBeansOfType(EasyMock.eq(SomeDependency2.class)))
        .andReturn(map2).anyTimes();


    Map<String, SomeDependency1> map1  = new HashMap<>();
    map1.put("someDep1", new SomeDependency1());
    map1.put("anotherDep1", new SomeDependency1());
    EasyMock.expect(ctx.getBeansOfType(EasyMock.eq(SomeDependency1.class)))
        .andReturn(map1).anyTimes();

    EasyMock.replay(ctx);

    InjectResourceFactory factory = new InjectResourceFactory(ctx);


    // #4 ambiguous dep
    try
    {
      factory.setRootResources(pathRootResourceMap);

      fail("Expected unresolvable bean exception");
    }
    catch (RestLiInternalException e)
    {
      assertTrue(e.getMessage().startsWith("Expected to find"));
    }

    EasyMock.verify(ctx);
    EasyMock.reset(ctx);
  }