此内容没有您所选择的语言版本。
Chapter 4. Injection of CDI beans into tests
You can perform unit testing and test CDI beans directly. Quarkus enables you to inject CDI beans into your tests through the @Inject annotation. In fact, tests in Quarkus are full CDI beans so you can use the complete CDI functionality.
Note
It is not possible to use injection with native tests.
Procedure
Create the
GreetingServiceTest.javafile with the following content:Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- The
GreetingServicebean will be injected into the test.