}
@Test
public void testEndpointServiceConstructor() throws Exception {
GreeterImpl greeter = new GreeterImpl();
JaxWsServiceFactoryBean serviceFactory = new JaxWsServiceFactoryBean();
serviceFactory.setBus(getBus());
serviceFactory.setInvoker(new BeanInvoker(greeter));
serviceFactory.setServiceClass(GreeterImpl.class);
EndpointImpl endpoint = new EndpointImpl(getBus(), greeter,
new JaxWsServerFactoryBean(serviceFactory));
WebServiceContext ctx = greeter.getContext();
assertNull(ctx);
try {
String address = "http://localhost:8080/test";
endpoint.publish(address);
} catch (IllegalArgumentException ex) {
assertTrue(ex.getCause() instanceof BusException);
assertEquals("BINDING_INCOMPATIBLE_ADDRESS_EXC", ((BusException)ex.getCause()).getCode());
}
ctx = greeter.getContext();
assertNotNull(ctx);
}