-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IllegalStateException: cacheDir is null after upgrade from version 0.8.0 to 0.10.0 #101
Comments
The trouble is that the mock itself is currently not meant to be re-used once stop() has been called. It should work fine if the mock is static within the test class. Can you explain a bit more on why you inject it rather than constructing it as a JUnit class rule (as described in the readme)? |
If I use:
instead of
I get the following error:
And then I get a 401 during the test. |
Hm, that's odd. It should work just like that. But I guess that's a side track. I acknowledge that re-using the mock should be possible, so I'll look into how to make this work. |
and introduce Dagger to set up dependency injection fixes #101 Signed-off-by: Kai Helbig <[email protected]>
and introduce Dagger to set up dependency injection fixes #101 Signed-off-by: Kai Helbig <[email protected]>
Hello all and thanks in advance for this great tool,
I'm current using Java 1.8, Spring Boot 2.5.2 and JUnit 4.14.2.
After I migrated from
mock-junit
version0.8.0
to0.10.0
, I started to get the following error when I try to start the mock:In my test, I start/stop the mock using the
@Before
and@After
annotation like this:The mock is injected using the
@Resource
annotation:Finally, I managed to fix this issue cleaning the Application Context after each test using
@DirtiesContext(classMode = BEFORE_EACH_TEST_METHOD)
at the beginning of my test class. However, using this method is resource intense and increases the execution time from 3 min to 12, so I had to keep using version0.8.0
.The text was updated successfully, but these errors were encountered: