### Question:
ConcurrentRuntime implements PostConstruct, PreDestroy { private ContextSetupProviderImpl.CONTEXT_TYPE[] parseContextInfo(String contextInfo, boolean isContextInfoEnabled) { ArrayList<ContextSetupProviderImpl.CONTEXT_TYPE> contextTypeArray = new ArrayList<>(); ContextSetupProviderImpl.CONTEXT_TYPE[] contextTypes = new ContextSetupProviderImpl.CONTEXT_TYPE[] {}; if (contextInfo == null) { contextTypeArray.add(ContextSetupProviderImpl.CONTEXT_TYPE.CLASSLOADING); contextTypeArray.add(ContextSetupProviderImpl.CONTEXT_TYPE.NAMING); contextTypeArray.add(ContextSetupProviderImpl.CONTEXT_TYPE.SECURITY); contextTypeArray.add(ContextSetupProviderImpl.CONTEXT_TYPE.WORKAREA); return contextTypeArray.toArray(contextTypes); } if (isContextInfoEnabled) { StringTokenizer st = new StringTokenizer(contextInfo, ",", false); while(st.hasMoreTokens()) { String token = st.nextToken().trim(); if (CONTEXT_INFO_CLASSLOADER.equalsIgnoreCase(token)) { contextTypeArray.add(ContextSetupProviderImpl.CONTEXT_TYPE.CLASSLOADING); } else if (CONTEXT_INFO_JNDI.equalsIgnoreCase(token)) { contextTypeArray.add(ContextSetupProviderImpl.CONTEXT_TYPE.NAMING); } else if (CONTEXT_INFO_SECURITY.equalsIgnoreCase(token)) { contextTypeArray.add(ContextSetupProviderImpl.CONTEXT_TYPE.SECURITY); } else if (CONTEXT_INFO_WORKAREA.equalsIgnoreCase(token)) { contextTypeArray.add(ContextSetupProviderImpl.CONTEXT_TYPE.WORKAREA); } } } return contextTypeArray.toArray(contextTypes); } ConcurrentRuntime(); static ConcurrentRuntime getRuntime(); ComponentEnvManager getCompEnvMgr(); synchronized ContextServiceImpl getContextService(ResourceInfo resource, ContextServiceConfig config); void shutdownContextService(String jndiName); synchronized ManagedExecutorServiceImpl getManagedExecutorService(ResourceInfo resource, ManagedExecutorServiceConfig config); void shutdownManagedExecutorService(String jndiName); synchronized ManagedScheduledExecutorServiceImpl getManagedScheduledExecutorService(ResourceInfo resource,
                                                                                               ManagedScheduledExecutorServiceConfig config); void shutdownScheduledManagedExecutorService(String jndiName); synchronized ManagedThreadFactoryImpl getManagedThreadFactory(ResourceInfo resource, ManagedThreadFactoryConfig config); void shutdownManagedThreadFactory(String jndiName); @Override void postConstruct(); @Override void preDestroy(); static final String CONTEXT_INFO_CLASSLOADER; static final String CONTEXT_INFO_JNDI; static final String CONTEXT_INFO_SECURITY; static final String CONTEXT_INFO_WORKAREA; }### Answer:
@Test public void testParseContextInfo() throws Exception { expect(contextServiceConfig.getJndiName()).andReturn("concurrent/ctxSrv").anyTimes(); expect(contextServiceConfig.getContextInfo()).andReturn("Classloader, JNDI, Security, WorkArea").anyTimes(); expect(contextServiceConfig.getContextInfoEnabled()).andReturn("true"); replay(contextServiceConfig); ConcurrentRuntime concurrentRuntime = new ConcurrentRuntime(); ResourceInfo resource = new ResourceInfo("test"); ContextServiceImpl contextService = concurrentRuntime.getContextService(resource, contextServiceConfig); ContextSetupProviderImpl contextSetupProvider = (ContextSetupProviderImpl) contextService.getContextSetupProvider(); assertTrue((Boolean) Util.getdFieldValue(contextSetupProvider, "classloading")); assertTrue((Boolean) Util.getdFieldValue(contextSetupProvider, "naming")); assertTrue((Boolean) Util.getdFieldValue(contextSetupProvider, "security")); assertTrue((Boolean) Util.getdFieldValue(contextSetupProvider, "workArea")); }