mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-07-25 11:43:29 +00:00
* test/net/sf/acegisecurity/taglibs/authz/AuthorizeTagTests.java:
Bring Clover coverage to 100% by adding a single test.
This commit is contained in:
parent
1490e8a707
commit
d8275171e4
@ -71,6 +71,15 @@ public class AuthorizeTagTests extends TestCase {
|
|||||||
Tag.EVAL_BODY_INCLUDE, authorizeTag.doStartTag());
|
Tag.EVAL_BODY_INCLUDE, authorizeTag.doStartTag());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testPreventsBodyOutputIfNoSecureContext()
|
||||||
|
throws JspException {
|
||||||
|
ContextHolder.setContext(null);
|
||||||
|
authorizeTag.setIfAnyGranted("ROLE_BANKER");
|
||||||
|
|
||||||
|
assertEquals("prevents output - no context defined", Tag.SKIP_BODY,
|
||||||
|
authorizeTag.doStartTag());
|
||||||
|
}
|
||||||
|
|
||||||
public void testSkipsBodyIfNoAnyRolePresent() throws JspException {
|
public void testSkipsBodyIfNoAnyRolePresent() throws JspException {
|
||||||
authorizeTag.setIfAnyGranted("ROLE_BANKER");
|
authorizeTag.setIfAnyGranted("ROLE_BANKER");
|
||||||
assertEquals("unauthorized - ROLE_BANKER not in granted authorities",
|
assertEquals("unauthorized - ROLE_BANKER not in granted authorities",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user