@Test public void testGetDefaultPhases() { PhaseIdType[] defaults; defaults = listener.getDefaultPhases("/qualified/no.xhtml"); Assert.assertEquals(1, defaults.length); Assert.assertEquals(PhaseIdType.INVOKE_APPLICATION, defaults[0]); }
@Test public void testIsAnnotationApplicableToPhase() { Assert.assertEquals( true, listener.isAnnotationApplicableToPhase( new RestrictedLiteral(), PhaseIdType.RENDER_RESPONSE, RestrictAtPhaseDefault.DEFAULT_PHASES)); Assert.assertEquals( false, listener.isAnnotationApplicableToPhase( new RestrictedLiteral(PhaseIdType.RESTORE_VIEW), PhaseIdType.RENDER_RESPONSE, RestrictAtPhaseDefault.DEFAULT_PHASES)); Assert.assertEquals( true, listener.isAnnotationApplicableToPhase( new RestrictedLiteral(PhaseIdType.RESTORE_VIEW), PhaseIdType.RESTORE_VIEW, RestrictAtPhaseDefault.DEFAULT_PHASES)); }
@Test public void testIsRestrictPhase() { List<? extends Annotation> restrict; restrict = listener.getRestrictionsForPhase(PhaseIdType.RENDER_RESPONSE, "/qualified/yes.xhtml"); Assert.assertEquals(1, restrict.size()); restrict = listener.getRestrictionsForPhase(PhaseIdType.INVOKE_APPLICATION, "/qualified/yes.xhtml"); Assert.assertEquals(1, restrict.size()); restrict = listener.getRestrictionsForPhase(PhaseIdType.RESTORE_VIEW, "/qualified/yes.xhtml"); Assert.assertEquals(null, restrict); restrict = listener.getRestrictionsForPhase(PhaseIdType.RENDER_RESPONSE, "/qualified/no.xhtml"); Assert.assertEquals(null, restrict); restrict = listener.getRestrictionsForPhase(PhaseIdType.INVOKE_APPLICATION, "/qualified/no.xhtml"); Assert.assertEquals(1, restrict.size()); restrict = listener.getRestrictionsForPhase(PhaseIdType.RENDER_RESPONSE, "/happy/cat.xhtml"); Assert.assertEquals(null, restrict); }