Wiremock returning 404 for a stubbed url
As per Stubbing - Wiremock (the 1st in Google on "wiremockserver urlequalto"):
Note: you must use
urlPathEqualTo
orurlPathMatching
to specify the path, asurlEqualTo
orurlMatching
will attempt to match the whole request URL, including the query parameters.
For anyone who is trying to add Wiremock to an Android app and stumbles upon this question:
If you run your mocking after the network call is made, it won't work. This may seem obvious but I was tripped up on it.
When you run an Espresso test, by default the activity test rule launches the activity right away, and so the activity was firing and pulling it's config data before my mocking code was actually run. I was seeing the same error as OP.
The fix is to make your activity test rule not launch initially, then mock your data, and tell the activity to start once you've done all that.