CallContext { public Object getContextParameter(Object key) { Object value = context.get(key); if(value == null ) { value = context.get(key.toString()); } return value; } protected  CallContext(); protected  CallContext(long userId, long accountId, String contextId); protected  CallContext(User user, Account account, String contextId); static void init(EntityManager entityMgr); void putContextParameter(Object key, Object value); Object getContextParameter(Object key); long getCallingUserId(); User getCallingUser(); String getContextId(); Account getCallingAccount(); static CallContext current(); static CallContext register(User callingUser, Account callingAccount, String contextId); static CallContext registerPlaceHolderContext(); static CallContext register(User callingUser, Account callingAccount); static CallContext registerSystemCallContextOnceOnly(); static CallContext register(String callingUserUuid, String callingAccountUuid); static CallContext register(long callingUserId, long callingAccountId); static CallContext register(long callingUserId, long callingAccountId, String contextId); static void unregisterAll(); static CallContext unregister(); void setStartEventId(long startEventId); long getStartEventId(); long getCallingAccountId(); String getCallingAccountUuid(); String getCallingUserUuid(); void setEventDetails(String eventDetails); String getEventDetails(); String getEventType(); void setEventType(String eventType); String getEventDescription(); void setEventDescription(String eventDescription); Project getProject(); void setProject(Project project); boolean isEventDisplayEnabled(); void setEventDisplayEnabled(boolean eventDisplayEnabled); Map<Object, Object> getContextParameters(); void putContextParameters(Map<Object, Object> details); static void setActionEventInfo(String eventType, String description); @Override String toString();  }
@Test public void testGetContextParameter() { CallContext currentContext = CallContext.current(); Assert.assertEquals("There is nothing in the context. It should return null", null, currentContext.getContextParameter("key")); Assert.assertTrue("There is nothing in the context. The map should be empty", currentContext.getContextParameters().isEmpty()); UUID objectUUID = UUID.randomUUID(); UUID stringUUID = UUID.randomUUID(); currentContext.putContextParameter(User.class, objectUUID); Assert.assertEquals("it should return objectUUID: " + objectUUID, objectUUID, currentContext.getContextParameter(User.class)); Assert.assertEquals("current context map should have exactly one entry", 1, currentContext.getContextParameters().size()); currentContext.putContextParameter(Account.class.toString(), stringUUID); Assert.assertEquals("it should return stringUUID: " + stringUUID, stringUUID, currentContext.getContextParameter(Account.class)); Assert.assertEquals("current context map should have exactly two entries", 2, currentContext.getContextParameters().size()); currentContext.putContextParameter(Account.class, objectUUID); Assert.assertEquals("it should return objectUUID: " + objectUUID, objectUUID, currentContext.getContextParameter(Account.class)); Assert.assertEquals("current context map should have exactly three entries", 3, currentContext.getContextParameters().size()); }