I would like to access the requestContext property of the MockUp class instance WebServiceProxyInstance. The property only exists in the mock class and is not part of the implemented interfaces. Is there any way to do this?
@Test public <WebServiceProxy extends WebService & BindingProvider> void callWebServiceTest() {
final WebService WebServiceProxyInstance = new MockUp<WebServiceProxy>() {
public Map<String, Object> requestContext = new HashMap<String, Object>();
@Mock public Map<String, Object> getRequestContext() { return requestContext; }
}.getMockInstance();
System.out.println("Count: " + WebServiceProxyInstance.requestContext.count)
}
This code throws:
java.lang.Error: Unresolved compilation problem: requestContext cannot be resolved or is not a field