Closed praisane closed 6 years ago
@praisane Just pushed a fix with your suggestion. Could you try it out please? You can use the snapshot version.
Hi @tommysitu
I can confirm that with version 0.11.1-SNAPSHOT the problem doesn't occur any more.
Thanks for the quick response, 'OPR
fixed in version 0.11.1
If using maven and the surefire plugin with default settings to execute more than one test using a the HoverflyRule as a @ClassRule in a superclass, only the first test succeeds as the next test will fail to connect to Hoverfly.
This happens because hoverfly-java's VM shutdown hook as already executed and shut it down. However the Hoverfly class instance remains loaded and thus its startedProcess field is non-null, which causes the next test to assume it's already initialized:
To fix this issue I think the easiest way would be just to set the startedProcess field to null at the end of the io.specto.hoverfly.junit.core.Hoverfly. cleanUp() method.
Fortunately there's a workaround - disable forked VM reuse of the surefire plugin in your project's POM.