-
Notifications
You must be signed in to change notification settings - Fork 98
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
TestEntityManager initialize to null #415
Comments
Same for me. I would even say that @JGivenStage isn't working as it should |
Could you check the Spring logs for errors? Because I was able to inject the TestEntityManager. See https://github.com/TNG/JGiven/blob/master/example-projects/spring-boot/src/test/java/com/tngtech/jgiven/example/springboot/JpaTest.java |
I m facing the same issue. I guess the difference in your samples is that you are using a SimpleSpringRuleScenarioTest< Stage > instead of SpringScenarioTest<GivenStage, WhenStage, ThenStage> the annotation is only applied to the givenstage in my case |
It looks like the spring config is the root-cause. Lets look at the documentation of
As you can see, As a workaround you can just define this on your test class: I am also thinking about adding this to the |
@componentscan ist not active when using @DataJpaTest. Adding it manually works for now. We should discuss if we want to support that mechanism of Spring Data more deeply.
@componentscan ist not active when using @DataJpaTest. Adding it manually works for now. We should discuss if we want to support that mechanism of Spring Data more deeply.
Hi,
I'm trying to inject TestEntityManager to Stage.
I use @DataJpaTest. My test class look like this:
And if I want to inject TestEntityManager to Given stage:
it is initialized to null and NPE is thrown.
Am I doing something wrong?
The text was updated successfully, but these errors were encountered: