From d8275171e40be0458a9f1f3a1388805d5fb21cf9 Mon Sep 17 00:00:00 2001 From: Francois Beausoleil Date: Tue, 23 Mar 2004 17:28:10 +0000 Subject: [PATCH] * test/net/sf/acegisecurity/taglibs/authz/AuthorizeTagTests.java: Bring Clover coverage to 100% by adding a single test. --- .../acegisecurity/taglibs/authz/AuthorizeTagTests.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/core/src/test/java/org/acegisecurity/taglibs/authz/AuthorizeTagTests.java b/core/src/test/java/org/acegisecurity/taglibs/authz/AuthorizeTagTests.java index 49b1ed4736..32afcfae35 100644 --- a/core/src/test/java/org/acegisecurity/taglibs/authz/AuthorizeTagTests.java +++ b/core/src/test/java/org/acegisecurity/taglibs/authz/AuthorizeTagTests.java @@ -71,6 +71,15 @@ public class AuthorizeTagTests extends TestCase { 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 { authorizeTag.setIfAnyGranted("ROLE_BANKER"); assertEquals("unauthorized - ROLE_BANKER not in granted authorities",