I am trying to figure out how to write a JUnittest case that can test my service endpoint outside of the servlet container. My axis service endpoint extends springs ServletEndpointSupport but I cannot seem to find any mock objects that will help me initialize this object correctly.
To initialize the servlet, I need to call the init method from the ServiceLifecycle Interface:
I'm not familiar with ServletEndpointSupport, but most WS are at the core based on a Java POJO that has no dependencies on external objects (only the libraries it needs to complete its service). Wouldn't it make more sense to unit-test that?
Joined: Jun 04, 2001
Normally it would. This class however makes use of the Spring Context to get some of its dependencies. If this was a normal Spring servlet, I could create a spring context and insert it into a mock servlet context and initialize the servlet with that. Unfortunately, because this class implements ServiceLifecycle, the init method is now looking for ServletEndpointContext instead.
Any other ideas?
subject: How to Unit test an axis service that extends ServletEndpointSupport?