/** Test fail-fast for components without interface. */
 public void testComponentMustImplementInterface() {
   try {
     new ThreadLocalizing.ThreadLocalized(
         new ConstructorInjection.ConstructorInjector(Object.class, Object.class));
     fail("PicoCompositionException expected");
   } catch (final PicoCompositionException e) {
     assertTrue(e.getMessage().endsWith("It does not implement any interfaces."));
   }
 }
  public void testDuplicateRegistrationWithTypeAndObject() throws PicoCompositionException {
    DefaultPicoContainer pico = new DefaultPicoContainer();

    pico.addComponent(SimpleTouchable.class);
    try {
      pico.addComponent(SimpleTouchable.class, new SimpleTouchable());
      fail("Should have barfed with dupe registration");
    } catch (PicoCompositionException e) {
      // expected
      assertTrue(e.getMessage().startsWith("Duplicate"));
      assertTrue(e.getMessage().indexOf(SimpleTouchable.class.getName()) > 0);
    }
  }