コード例 #1
0
 @Test
 public void beginRenderElse() {
   Block block = mock(Block.class);
   ReflectionTestUtils.setField(victim, "elseBlock", block);
   victim.setupRender();
   assertEquals(victim.beginRender(), block);
 }
コード例 #2
0
 @Test
 public void beforeRenderBodyIfNotGranted() {
   ReflectionTestUtils.setField(victim, "ifNotGranted", PERMISSION + "," + PERMISSION_2);
   SecurityContextHolder.getContext()
       .setAuthentication(new TestingAuthenticationToken(USER, null));
   victim.setupRender();
   assertTrue(victim.beforeRenderBody());
 }
コード例 #3
0
 @Test
 public void beginRender() {
   Block block = mock(Block.class);
   ReflectionTestUtils.setField(victim, "elseBlock", block);
   ReflectionTestUtils.setField(victim, "ifAnyGranted", PERMISSION);
   SecurityContextHolder.getContext()
       .setAuthentication(new TestingAuthenticationToken(USER, null, PERMISSION));
   victim.setupRender();
   assertNull(victim.beginRender());
 }
コード例 #4
0
 @Test
 public void beforeRenderBodyNone() {
   victim.setupRender();
   assertFalse(victim.beforeRenderBody());
 }