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/08 05:46:00 UTC

[jira] [Commented] (CXF-7937) Unable to mock stub and JaxWsProxyFactoryBean in jax rs service

    [ https://issues.apache.org/jira/browse/CXF-7937?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16736753#comment-16736753 ] 

Srikanth Krishnamurthy commented on CXF-7937:
---------------------------------------------

Hi [~coheigea] - can you please advise where to post my query as i couldn't find a place and ended up creating a Jira ?

Additionally would be grateful if you can help to resolve my cxf integration with junit issue on my above error description that i have mentioned. thanks in advance.

> 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
>            Priority: Minor
>
> 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)