final Map map = new HashMap(); map.put(DI1.class.getName(), new D1()); map.put(DI2.class.getName(), new D2());  Dispatcher callback = new Dispatcher() { public Object loadObject(String className) { return map.get(className);
final Object[] impls = new Object[]{ new Foo() { public String foo() { return "foo1"; } }, new Bar() { public String bar() { return "bar1"; }
    public void testSimple() throws Exception {        final Map map = new HashMap();        map.put(DI1.class.getName(), new D1());        map.put(DI2.class.getName(), new D2());        Dispatcher callback = new Dispatcher() {            public Object loadObject(String className) {                return map.get(className);            }        };        Object obj = Enhancer.create(Object.class,                                     new Class[]{ DI1.class, DI2.class },                                     callback);        assertTrue(((DI1)obj).herby().equals("D1"));        assertTrue(((DI2)obj).derby().equals("D2"));    }