@Test public void evaluatesBodyIfUrlIsAllowed() throws Exception { authorizeTag.setUrl("/allowed"); authorizeTag.setMethod("GET"); assertThat(authorizeTag.doStartTag()).isEqualTo(Tag.EVAL_BODY_INCLUDE); }
@Test public void skipsBodyIfMethodIsNotAllowed() throws Exception { authorizeTag.setUrl("/allowed"); authorizeTag.setMethod("POST"); assertThat(authorizeTag.doStartTag()).isEqualTo(Tag.SKIP_BODY); }
// url attribute tests @Test public void skipsBodyWithUrlSetIfNoAuthenticationPresent() throws Exception { SecurityContextHolder.clearContext(); authorizeTag.setUrl("/something"); assertThat(authorizeTag.doStartTag()).isEqualTo(Tag.SKIP_BODY); }