BackgroundTaskThreadLocalManagerImpl implements BackgroundTaskThreadLocalManager { @Override public void serializeThreadLocals( Map<String, Serializable> taskContextMap) { HashMap<String, Serializable> taskContextThreadLocalValues = (HashMap<String, Serializable>)taskContextMap.get( KEY_THREAD_LOCAL_VALUES); if (taskContextThreadLocalValues == null) { taskContextThreadLocalValues = new HashMap<>(); taskContextMap.put( KEY_THREAD_LOCAL_VALUES, taskContextThreadLocalValues); } Map<String, Serializable> currentThreadLocalValues = getThreadLocalValues(); taskContextThreadLocalValues.putAll(currentThreadLocalValues); }  @Override void deserializeThreadLocals(
		Map<String, Serializable> taskContextMap); @Override Map<String, Serializable> getThreadLocalValues(); @Override void serializeThreadLocals(
		Map<String, Serializable> taskContextMap); @Override void setThreadLocalValues(
		Map<String, Serializable> threadLocalValues);  }
@Test public void testSerializeThreadLocals() { initalizeThreadLocals(); Map<String, Serializable> taskContextMap = new HashMap<>(); backgroundTaskThreadLocalManagerImpl.serializeThreadLocals( taskContextMap); Map<String, Serializable> threadLocalValues = (Map<String, Serializable>)taskContextMap.get( BackgroundTaskThreadLocalManagerImpl.KEY_THREAD_LOCAL_VALUES); assertThreadLocalValues(threadLocalValues); }