ThreadLocalLogEvent extends ThreadLocal<LogEvent> { public LogEvent initialValue() { LogEvent logEvent = new LogEvent(); logEvent.setActiveProfile(APITestHarness.getInstance().getAgentRunData().getActiveProfile()); logEvent.setProjectName(APITestHarness.getInstance().getAgentRunData().getProjectName()); logEvent.setJobId(APITestHarness.getInstance().getAgentRunData().getJobId()); logEvent.setInstanceId(APITestHarness.getInstance().getAgentRunData().getInstanceId()); logEvent.setSourceType(SourceType.agent); HostInfo hostInfo = new HostInfo(); logEvent.setPublicIp(hostInfo.getPublicIp()); logEvent.setHostname(hostInfo.getPublicHostname()); logEvent.setThreadId(Thread.currentThread().getName() + " " + Thread.currentThread().getId()); ThreadContext.put("jobId", APITestHarness.getInstance().getAgentRunData().getJobId()); ThreadContext.put("projectName", APITestHarness.getInstance().getAgentRunData().getProjectName()); ThreadContext.put("instanceId", APITestHarness.getInstance().getAgentRunData().getInstanceId()); ThreadContext.put("publicIp", hostInfo.getPublicIp()); ThreadContext.put("region", AmazonUtil.getVMRegion().getRegion()); ThreadContext.put("httpHost", AmazonUtil.getControllerBaseUrl()); return logEvent; }  LogEvent initialValue();  }
@Test public void testInitialValue_1() throws Exception { ThreadLocalLogEvent fixture = new ThreadLocalLogEvent(); LogEvent result = fixture.initialValue(); assertNotNull(result); }