GBeanData gbean = buildGBeanData("name", "test", ClassGBean.getGBeanInfo());
gbean.setAttribute("name", "Test");
kernel.loadGBean(gbean, myCl);
kernel.startGBean(gbean.getAbstractName());
ProxyManager mgr = kernel.getProxyManager();
Object test = mgr.createProxy(gbean.getAbstractName(), Named.class);
assertTrue(test instanceof Named);
assertFalse(test instanceof ClassGBean);
assertEquals("Test", ((Named)test).getName());
test = mgr.createProxy(gbean.getAbstractName(), myCl);
assertTrue(test instanceof Named);
assertFalse(test instanceof ClassGBean);
assertEquals("Test", ((Named)test).getName());
try {
mgr.createProxy(gbean.getAbstractName(), ClassGBean.class);
fail("expected an IllegalArgumentException");
} catch (IllegalArgumentException ignored) {
// expected
}
}