quarkus: @Inject PanacheRepository into @QuarkusTest causes "This method is normally automatically overridden in subclasses: did you forget to annotate your entity with @Entity?"
Describe the bug
If the class implementing PanacheRepository is injected into @QuarkusTest, the test will throw infamous “This method is normally automatically overridden in subclasses: did you forget to annotate your entity with @Entity?”
Expected behavior
PanacheRepository implementor is injected and can be used to manipulate entities.
Actual behavior
Throws
Caused by: java.lang.IllegalStateException: This method is normally automatically overridden in subclasses: did you forget to annotate your entity with @Entity?
at io.quarkus.hibernate.orm.panache.runtime.JpaOperations.implementationInjectionMissing(JpaOperations.java:408)
To Reproduce
Steps to reproduce the behavior:
- @Inject PanacheRepository into @QuarkusTest
- mvn clean test
Configuration
quarkus.datasource.driver = org.h2.Driver
quarkus.datasource.url=jdbc:h2:mem:test"
quarkus.datasource.username=sa
quarkus.datasource.password=sa
quarkus.hibernate-orm.database.generation=drop-and-create
Screenshots
(If applicable, add screenshots to help explain your problem.)
Environment (please complete the following information):
- Output of
uname -a
orver
: Microsoft Windows [Version 10.0.19041.1] - Output of
java -version
:
java version "1.8.0_231"
Java(TM) SE Runtime Environment (build 1.8.0_231-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.231-b11, mixed mode)
-
GraalVM version (if different from Java): not tested
-
Quarkus version or git rev: 1.1.0.Final
Additional context
Maven project: rest.zip
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 2
- Comments: 19 (6 by maintainers)
The issue is known and is being worked on as we speak. The issue is complicated by how junit 5 deals with classloaders, but a solution will be land soon enough.
It would be amazing if you crack this, as Arquillian or other complicated solutions will not be needed anymore.