quarkiverse / quarkus-cxf

Quarkus CXF Extension to support SOAP based web services.
Apache License 2.0
71 stars 57 forks source link

Mocking Junit test case for RestClientBuilder #1417

Open sreekar12 opened 1 week ago

sreekar12 commented 1 week ago

Can you please help how to mock RestClientBuilder using @QuarkusComponentTest or any other Mocking functions like Mockito or powerMockito

Example : RestClientBuilder.newBuilder().baseUri(URI).build(HandlerService.class);

could you please provide a sample mocking example for above line.

ppalaga commented 1 week ago

Can you please help how to mock RestClientBuilder

If you are trying to use Quarkus CXF for serving REST endpoints or for accessing them using CXF rest client, then the answer is no. Quarkus CXF supports solely those parts of CXF that are related to SOAP WebServices. See also https://docs.quarkiverse.io/quarkus-cxf/dev/index.html#:~:text=While%20Apache%20CXF%20implements%20wide%20range%20of%20standards%20and%20specifications%2C%20Quarkus%20CXF%20is%20currently%20focusing%20only%20on%20supporting%20the%20ones%20related%20to%20Simple%20Object%20Access%20Protocol%20(SOAP)%20and%20Java%20API%20for%20XML%20Web%20Services%20(JAX%2DWS).%20Refer%20to%20Reference%20to%20learn%20which%20parts%20of%20CXF%20are%20supported.

If you are using Quarkus REST, then we cannot help either. Quick googling shows this StackOverflow question that may be what you are looking for https://stackoverflow.com/questions/56393462/how-to-mock-rest-clients-when-unittesting-a-quarkus-application