### Question:
ExecutionContext implements Context { @Override public void storeAgent(Agent agent) throws AgentAccessDeniedException, AgentAlreadyExistsException, AgentOperationFailedException, AgentLockedException { if (agent.isLocked()) { throw new AgentLockedException(); } else if (agent instanceof AnonymousAgent) { throw new AgentAccessDeniedException("Anonymous agent must not be stored"); } else if (agent instanceof GroupAgentImpl) { ((GroupAgentImpl) agent).apply(); } try { node.storeAgent((AgentImpl) agent); } catch (AgentAlreadyExistsException | AgentLockedException | AgentAccessDeniedException | AgentOperationFailedException e) { throw e; } catch (AgentException e) { throw new AgentOperationFailedException(e); } } ExecutionContext(ServiceAgentImpl agent, AgentContext context, Node node); static ExecutionContext getCurrent(); AgentContext getCallerContext(); @Override ClassLoader getServiceClassLoader(); @Override ExecutorService getExecutor(); @Override Service getService(); @SuppressWarnings("unchecked") @Override T getService(Class<T> serviceType); @Override ServiceAgent getServiceAgent(); @Override Agent getMainAgent(); @Override Serializable invoke(String service, String method, Serializable... parameters); @Override Serializable invoke(ServiceNameVersion service, String method, Serializable... parameters); @Override Serializable invokeInternally(String service, String method, Serializable... parameters); @Override Serializable invokeInternally(ServiceNameVersion service, String method, Serializable... parameters); @Override void monitorEvent(String message); @Override void monitorEvent(MonitoringEvent event, String message); @Override void monitorEvent(Object from, MonitoringEvent event, String message); @Override void monitorEvent(Object from, MonitoringEvent event, String message, boolean includeActingUser); @Override UserAgent createUserAgent(String passphrase); @Override GroupAgent createGroupAgent(Agent[] members); @Override Agent fetchAgent(String agentId); @Override Agent requestAgent(String agentId, Agent using); @Override Agent requestAgent(String agentId); @Override void storeAgent(Agent agent); @Override boolean hasAccess(String agentId, Agent using); @Override boolean hasAccess(String agentId); @Override String getUserAgentIdentifierByLoginName(String loginName); @Override String getUserAgentIdentifierByEmail(String emailAddress); @Override void registerReceiver(MessageReceiver receiver); @Override Logger getLogger(Class<?> cls); @Override Envelope requestEnvelope(String identifier, Agent using); @Override Envelope requestEnvelope(String identifier); @Override void storeEnvelope(Envelope env, Agent using); @Override void storeEnvelope(Envelope env); @Override void storeEnvelope(Envelope env, EnvelopeCollisionHandler handler, Agent using); @Override void storeEnvelope(Envelope env, EnvelopeCollisionHandler handler); @Override void reclaimEnvelope(String identifier, Agent using); @Override void reclaimEnvelope(String identifier); @Override Envelope createEnvelope(String identifier, Agent using); @Override Envelope createEnvelope(String identifier);  }### Answer:
@Test public void testStoreAnonymous() { try { AnonymousAgentImpl anonymous = AnonymousAgentImpl.getInstance(); context.storeAgent(anonymous); Assert.fail("Exception expected"); } catch (AgentAccessDeniedException e) { } catch (Exception e) { e.printStackTrace(); Assert.fail(e.toString()); } }