Hi Dropwizarders,

I noticed that dropwizard provide the SecurityContext feature 
<https://www.dropwizard.io/0.9.0/docs/manual/auth.html#protecting-resources>, 
which is really convenient to protect resources. However, I can't find an 
easy way to do unit test for it, i.e., I do not know how to easily mock the 
SecurityContext as it is generated by some container. I found the "Test 
protecting resources" document 
<https://www.dropwizard.io/0.9.0/docs/manual/auth.html#protecting-resources>, 
which just follows the SecurityContext feature, but it doesn't describe how 
to get rid of SecurityContext.

More details: I have a controller which receives an user input (which is a 
request body) and a SecurityContext. In the unit test, I would like to mock 
the SecurityContext so that when sending request it won't really go to 
generate a real SecurityContext but just take the mocked one. I am not sure 
if this is the best way to test the controller in dropwizard - so please 
let me know if there are some alternatives.

Thank you!

Best,
Sean

-- 
You received this message because you are subscribed to the Google Groups 
"dropwizard-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to