Package io.quarkus.test.junit.mockito
Annotation Interface InjectSpy
When used on a field of a test class, the field becomes a Mockito spy,
that is then used to spy on the normal scoped bean which the field represents
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionboolean
If true, then Quarkus will change the scope of the targetSingleton
bean toApplicationScoped
.boolean
true
will create a mock that delegates all calls to the real bean, instead of creating a regular Mockito spy.
-
Element Details
-
delegate
boolean delegatetrue
will create a mock that delegates all calls to the real bean, instead of creating a regular Mockito spy. You should try this mode when you get errors like "Cannot call abstract real method on java object!" when calling adefault
interface method of a spied bean.- See Also:
-
AdditionalAnswers.delegatesTo(Object)
- Default:
- false
-
convertScopes
boolean convertScopesIf true, then Quarkus will change the scope of the targetSingleton
bean toApplicationScoped
. This is an advanced setting and should only be used if you don't rely on the differences betweenSingleton
andApplicationScoped
beans (for example it is invalid to read fields ofApplicationScoped
beans as a proxy stands in place of the actual implementation)- Default:
- false
-