You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Srikanth Krishnamurthy (JIRA)" <ji...@apache.org> on 2019/01/07 12:05:00 UTC
[jira] [Created] (CXF-7937) Unable to mock stub and
JaxWsProxyFactoryBean in jax rs service
Srikanth Krishnamurthy created CXF-7937:
-------------------------------------------
Summary: Unable to mock stub and JaxWsProxyFactoryBean in jax rs service
Key: CXF-7937
URL: https://issues.apache.org/jira/browse/CXF-7937
Project: CXF
Issue Type: Test
Reporter: Srikanth Krishnamurthy
Hello team, I am trying to test a jax rs service and trying to write junit for the same. It is failing because I am unable to mock the proxy object and it throws me an error mentioning "not a proxy instance". I am using mockito junit framework.
Here is my code for the creating the proxy and the junit that I am trying
public void getService(String endpoint){
ClientProxyFactoryBean proxyFactory = new JaxWsProxyFactoryBean();
proxyFactory.setServiceClass(Service.class);
proxyFactory.setAddress(endpoint);
service = (Service) proxyFactory.create();
Client proxy = ClientProxy.getClient(service );
}
junit:
@Mock
private Service service;
@Mock
private ClientProxyFactoryBean factoryBean;
@Test
public void testGetServiceObj() throws Exception {
factoryBean.setServiceClass(Service.class);
factoryBean.setAddress(endpoint);
assertThat(getService("http://test.com//api")
}
when i try to run test method, it returns "not a proxy instance" error. Please help to resolve the issue.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)