### Question:
AnnotationsShiroAuthorizationStrategy implements IAuthorizationStrategy { public <T extends IRequestableComponent> boolean isInstantiationAuthorized( final Class<T> componentClass) { final Annotation fail = checkInvalidInstantiation(componentClass); if (fail != null) { LOG.info("Unauthorized Instantiation :: component={} reason={} subject={}", new Object[] { componentClass, fail, SecurityUtils.getSubject() }); return false; } return true; }  ShiroSecurityConstraint checkInvalidInstantiation(
		final Class<T> componentClass); boolean isActionAuthorized(final Component component, final Action action); @Override boolean isResourceAuthorized(IResource resource, PageParameters parameters); boolean isInstantiationAuthorized(
		final Class<T> componentClass);  }### Answer:
@Test public void checkInstantiationWhenLoggedIn() { isLoggedIn = true; assertTrue(underTest.isInstantiationAuthorized(InstantiateWhen.LoggedInOnly.class)); }
@Test public void checkInstantiationWhenNotLoggedIn() { isLoggedIn = false; assertFalse(underTest.isInstantiationAuthorized(InstantiateWhen.LoggedInOnly.class)); }
@Test public void checkInstantiationWhenAuthenticated() { isAuthenticated = true; assertTrue(underTest.isInstantiationAuthorized(InstantiateWhen.AuthenticatedOnly.class)); }
@Test public void checkInstantiationWhenNotAuthenticated() { isLoggedIn = false; assertFalse(underTest.isInstantiationAuthorized(InstantiateWhen.AuthenticatedOnly.class)); }
@Test public void checkInstantiationForRole() { role = "ADMIN"; assertTrue(underTest.isInstantiationAuthorized(InstantiateWhen.SubjectHasRole.class)); }
@Test public void checkInstantiationForRoleNotPresent() { role = "USER"; assertFalse(underTest.isInstantiationAuthorized(InstantiateWhen.SubjectHasRole.class)); }
@Test public void checkInstantiationForPermission() { persmission = "any:permission"; assertTrue(underTest.isInstantiationAuthorized(InstantiateWhen.SubjectHasPermission.class)); }
@Test public void checkInstantiationForPermissionNotPresent() { persmission = "no:permission"; assertFalse(underTest.isInstantiationAuthorized(InstantiateWhen.SubjectHasPermission.class)); }