I am trying to compare the abilities of Soap UI and Wiremock using the following requirement (which is realistic enough for most cases in my projects).
Goal is to create a mock for a currency price service. The requirements:
Accessible at
mytesthost/priceservice/getprice
Expects one parameter called the 'cur' which defines the currenypair like: cur=EURHUF
When called as below should respond with an XML response saved in file EURHUF.xml.
mytesthost/priceservice/getprice?cur=EURHUF
When called as below should respond with an XML response saved in file EURUSD.xml.
mytesthost/priceservice/getprice?cur=EURUSD
When called with any other currencypair it should respond with an error response stored in NOCURR.xml
Implementing this in Soap UI boils down to preparing the result than implementing a few lines of Groovy code to select the response.
When approaching the problem with wiremock i can match for the two 'happpy' path cases but don't know how to achieve the fallback case (with NOCURR.xml).
Example on how i am doing the matching:
{
"request": {
"method": "GET",
"url": "/priceservice/getprice?cur=EURUSD"
},
"response": {
"status": 200,
"bodyFileName": "EURUSD.xml"
}
}
Can i achieve this with wiremock? I am mainly interested to do this via the Json configuration but if the Java API would be the way that is also fine.