public void testNewLazyInstance() throws Exception {
Collection<ServiceDeclaration> sds =
ServiceDiscovery.getInstance().getServiceDeclarations(TestInterface.class, true);
ExtensionPointRegistry registry = new DefaultExtensionPointRegistry();
Iterator<ServiceDeclaration> iterator = sds.iterator();
TestInterface ti = ServiceHelper.newLazyInstance(registry, iterator.next(), TestInterface.class);
Assert.assertTrue(Proxy.isProxyClass(ti.getClass()));
Assert.assertTrue(ti instanceof LifeCycleListener);
Assert.assertTrue(ti.toString().startsWith("Proxy"));
Assert.assertEquals(System.identityHashCode(ti), ti.hashCode());
ServiceHelper.start(ti);
ServiceHelper.stop(ti);
QName name = ti.getArtifactType();
Assert.assertEquals(new QName("http://sample", "Test2"), name);
String str = ti.test("ABC");
Assert.assertEquals("Test 2: ABC", str);
ServiceHelper.stop(ti);
}