-
Notifications
You must be signed in to change notification settings - Fork 566
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
4.x: MockBean fails with ArgumentMatcher #9397
Comments
romain-grecourt
added a commit
to romain-grecourt/helidon
that referenced
this issue
Oct 16, 2024
- Use Singleton instead of ApplicationScoped to avoid client proxies - Use produceWith instead of createWith - Use addTransitiveTypeClosure instead of addType to support more than just one type - Minor refactoring of the processMockBean method - Add unit test Fixes helidon-io#9397 Use a pseudo scope instead of ApplicationScoped to avoid client proxies
romain-grecourt
added a commit
to romain-grecourt/helidon
that referenced
this issue
Oct 16, 2024
- Use Singleton instead of ApplicationScoped to avoid client proxies - Use produceWith instead of createWith - Use addTransitiveTypeClosure instead of addType to support more than just one type - Minor refactoring of the processMockBean method - Add unit test Fixes helidon-io#9397
romain-grecourt
added a commit
to romain-grecourt/helidon
that referenced
this issue
Oct 16, 2024
- Call toString() to force initialization of the mocked instances - Use produceWith instead of createWith - Use addTransitiveTypeClosure instead of addType to support more than just one type - Minor refactoring of the processMockBean method - Add unit test Fixes helidon-io#9397
jbescos
added a commit
to jbescos/helidon
that referenced
this issue
Oct 16, 2024
Signed-off-by: Jorge Bescos Gascon <jorge.bescos.gascon@oracle.com>
jbescos
added a commit
to jbescos/helidon
that referenced
this issue
Oct 16, 2024
Signed-off-by: Jorge Bescos Gascon <jorge.bescos.gascon@oracle.com>
jbescos
added a commit
to jbescos/helidon
that referenced
this issue
Oct 16, 2024
Signed-off-by: Jorge Bescos Gascon <jorge.bescos.gascon@oracle.com>
jbescos
added a commit
to jbescos/helidon
that referenced
this issue
Oct 16, 2024
Signed-off-by: Jorge Bescos Gascon <jorge.bescos.gascon@oracle.com>
jbescos
added a commit
to jbescos/helidon
that referenced
this issue
Oct 16, 2024
Signed-off-by: Jorge Bescos Gascon <jorge.bescos.gascon@oracle.com>
jbescos
added a commit
to jbescos/helidon
that referenced
this issue
Oct 16, 2024
Signed-off-by: Jorge Bescos Gascon <jorge.bescos.gascon@oracle.com>
romain-grecourt
added a commit
to romain-grecourt/helidon
that referenced
this issue
Oct 16, 2024
- Call toString() to force initialization of the mocked instances - Use produceWith instead of createWith - Use addTransitiveTypeClosure instead of addType to support more than just one type - Minor refactoring of the processMockBean method - Add unit test Fixes helidon-io#9397
romain-grecourt
added a commit
to romain-grecourt/helidon
that referenced
this issue
Oct 17, 2024
- Call toString() to force initialization of the mocked instances - Use produceWith instead of createWith - Use addTransitiveTypeClosure instead of addType to support more than just one type - Minor refactoring of the processMockBean method - Add unit test - Re-work HelidonTestNgListener to initialize the testInstance with an extension Fixes helidon-io#9397
arjav-desai
pushed a commit
to arjav-desai/helidon
that referenced
this issue
Dec 11, 2024
- Call toString() to force initialization of the mocked instances - Use produceWith instead of createWith - Use addTransitiveTypeClosure instead of addType to support more than just one type - Minor refactoring of the processMockBean method - Add unit test - Re-work HelidonTestNgListener to initialize the testInstance with an extension Fixes helidon-io#9397 Fixes helidon-io#9411
danielkec
pushed a commit
to danielkec/helidon
that referenced
this issue
Dec 20, 2024
- Call toString() to force initialization of the mocked instances - Use produceWith instead of createWith - Use addTransitiveTypeClosure instead of addType to support more than just one type - Minor refactoring of the processMockBean method - Add unit test - Re-work HelidonTestNgListener to initialize the testInstance with an extension Fixes helidon-io#9397 Fixes helidon-io#9411 (cherry picked from commit 6a93b66)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Environment Details
Problem Description
If a test uses an argument matcher, it fails with the following error:
When mocked instances are created in ApplicationScoped the injected instance is a client proxy, and the mocked instance is lazily created on first usage. This breaks when using argument matchers.
A work-around is to call
toString()
on the mocked instance to force the creation of the mock before using matchers on the mocked instance.Steps to reproduce
The text was updated successfully, but these errors were encountered: