SecuredLocal bean = lookup("SecuredBean/local", SecuredLocal.class);
SecurityContext sc = SecurityContextFactory.createSecurityContext("test");
SecurityContextAssociation.setSecurityContext(sc);
assertEquals("nobody", bean.whoAmI());
try
{
bean.onlyAdmin();
fail("Should have thrown EJBAccessException");