Reputation: 1
Custom class that has jakarta core @Context SecurityContext throws following exception:
Method threw 'java.lang.IllegalStateException' exception. Cannot evaluate jakarta.ws.rs.core.ContextProducers_ProducerMethod_securityContext_4dee4dfc4a691eaefdabc3490f54879a07ccb609_ClientProxy.toString()
This happens when I do testing and invoking service method to test, which has this custom class injected. We utilize SecurityContext to retrieve some information and do some checks later in code.
Custom class is @RequestScoped.
We tried some different approaches from Quarkus documentation but without success. Is there a way to mock or initialize SecurityContext when doing unit tests or to have it in some test scope? How do you do unit test when having @Context SecurityContext usage?
Upvotes: 0
Views: 169