My application consumes external third-party webservices (Im successfully using cxf for this). How can I mock this webservices using local files to build pre-saved reponses (for test purposes) ?
More specifically:
I was thinking of using 2 maven projects: dao-ws and dao-ws-mock, both having the same interface.
The first dao-ws really calls the webservices using cxf, whereas the second dao-ws-mock uses local files to build pre-saved responses (used for test purposes).
mvn install
build the webapp project, whereas mvn install -DuseMock
build the webapp project with the dao-ws-mock dependency. Is this the correct way to do it? Is there a better/simpler way to do it?
Depending of the properties used, I will produce the same .war
, but with different behavior. It sounds to be a bad practice for me (for example, I don't want to push war with mock dependencies on our internal Nexus). What do you think?
Best regards,