@Test(expected = IllegalArgumentException.class)
 public void testInterfaceWithTwoImplementations() {
   StartingServiceWithInterfaceWithTwoImplementations instance =
       new InjectionObjectFactory()
           .getInstance(StartingServiceWithInterfaceWithTwoImplementations.class);
   assertNotNull(instance.getBean());
 }
  @Test
  public void testInterfaceWithTwoImplementationsSetImplementingClass() {
    InjectionObjectFactory factory = new InjectionObjectFactory();
    factory.setImplementingClassForInterface(
        HaveTwoImplementationsBean.class, Implementation1.class);

    StartingServiceWithInterfaceWithTwoImplementations instance =
        factory.getInstance(StartingServiceWithInterfaceWithTwoImplementations.class);
    assertNotNull(instance.getBean());
    assertTrue(instance.getBean() instanceof Implementation1);
  }
  @Test
  public void testInterfaceWithTwoImplementationsSetObjectForInterface() {
    InjectionObjectFactory factory = new InjectionObjectFactory();
    Implementation2 implementation2 = new Implementation2();
    factory.setImplementationForClassOrInterface(HaveTwoImplementationsBean.class, implementation2);

    StartingServiceWithInterfaceWithTwoImplementations instance =
        factory.getInstance(StartingServiceWithInterfaceWithTwoImplementations.class);
    assertNotNull(instance.getBean());
    assertTrue(instance.getBean() instanceof Implementation2);
    assertTrue(instance.getBean() == implementation2); // Must be the same object instance
  }