question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Wiremock stubs not loaded correctly with resetToDefaultMappings() when using a custom stubs location

See original GitHub issue

When a custom stub location is configured in @AutoConfigureWireMock and during tests the resetToDefaultMappings() is called then the custom stubs location is not taken into account but the default location “mappings” is used.

You can check that in the sample here https://github.com/m-kay/wiremock-reset-test with the test WiremockResetTestApplicationTests. If stubs on line 18 where configured to be in classpath:/wiremock/mappings it would work correctly because mappings is the default location.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
onobccommented, Dec 8, 2020

@m-kay I agree that would be a great place to put a hint. I will update the docs accordingly.

1reaction
m-kaycommented, Dec 7, 2020

Well to fix the issue I just used the default location and moved my stubs. Just opened this issue because I found it confusing and had to debug why my tests didn’t work. Maybe a hint to this behavior in the @AutoConfigureWireMock#stubs documentation would be helpful too.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Wiremock stubs not loaded correctly with resetToDefaultMappings ...
When a custom stub location is configured in @AutoConfigureWireMock and during tests the resetToDefaultMappings() is called then the custom stubs location ...
Read more >
Returning stubbed HTTP responses to specific requests
If you've created some file based stub mappings to be loaded at startup and you don't want these to disappear when you do...
Read more >
Best practice how to manage a lot of wiremock stubs?
One way you can avoid repeatedly writing the same stubbings is by defining the stub location while creating the wiremock server in the...
Read more >
97. Spring Cloud Contract WireMock
Wiremock runs as a stub server and you can register stub behavior using a ... is not working properly @ClassRule public static WireMockClassRule...
Read more >
Wiremock Stubbing, Stub Verification And Proxying With ...
Let's see some examples of stubbing using both Java code as well as JSON requests that could be sent directly to the Wiremock...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found