### Question:
ThreadDataLogger { public void report(int runNumber, Test test, long timeSinceExecutionStart, StatisticsSet statistics) { if (runNumber == m_lastRunNumber && m_lastRunNumber != -1) { m_buffer.setLength(m_bufferAfterRunNumberIndex); } else { m_lastRunNumber = runNumber; m_buffer.setLength(m_bufferAfterThreadIDIndex); m_buffer.append(runNumber); m_buffer.append(SEPARATOR); m_bufferAfterRunNumberIndex = m_buffer.length(); } m_buffer.append(test.getNumber()); m_buffer.append(SEPARATOR); m_buffer.append(timeSinceExecutionStart); for (ExpressionView expressionView : m_expressionViews) { m_buffer.append(SEPARATOR); final StatisticExpression expression = expressionView.getExpression(); if (expression.isDouble()) { m_buffer.append(expression.getDoubleValue(statistics)); } else { m_buffer.append(expression.getLongValue(statistics)); } } m_dataLog.info(m_buffer.toString(), new DataLogArguments(m_threadNumber, runNumber, test, timeSinceExecutionStart, statistics)); } ThreadDataLogger(Logger dataLog,
                          ExpressionView[] expressionViews,
                          int threadNumber); void report(int runNumber,
                     Test test,
                     long timeSinceExecutionStart,
                     StatisticsSet statistics);  }### Answer:
@Test public void testReport() throws Exception { final ThreadDataLogger ThreadDataLogger = new ThreadDataLogger( m_dataLogger, m_statisticsServices.getDetailStatisticsView().getExpressionViews(), 33); final StatisticsSet statistics = m_statisticsServices.getStatisticsSetFactory().create(); statistics.addSample(s_timedTestsIndex, 99); ThreadDataLogger.report(10, m_test1, 123L, statistics); verify(m_dataLogger).info(eq("33, 10, 1, 123, 99, 0"), m_argumentCaptor.capture()); final DataLogArguments arguments = m_argumentCaptor.getValue(); assertEquals(33, arguments.getThreadNumber()); assertEquals(10, arguments.getRunNumber()); assertSame(m_test1, arguments.getTest()); assertEquals(123L, arguments.getTimeSinceExecutionStart()); assertSame(statistics, arguments.getStatistics()); ThreadDataLogger.report(10, m_test1, 125L, statistics); verify(m_dataLogger).info(eq("33, 10, 1, 125, 99, 0"), m_argumentCaptor.capture()); ThreadDataLogger.report(11, m_test3, 300L, statistics); verify(m_dataLogger).info(eq("33, 11, 3, 300, 99, 0"), m_argumentCaptor.capture()); statistics.reset(); statistics.setValue(s_errorsIndex, 1); ThreadDataLogger.report(11, m_test3, 301L, statistics); verify(m_dataLogger).info(eq("33, 11, 3, 301, 0, 1"), m_argumentCaptor.capture()); }
@Test public void testReportCustomViews() throws Exception { m_statisticsServices.getDetailStatisticsView().add( m_statisticsServices.getStatisticExpressionFactory() .createExpressionView("foo", "userDouble0", false)); final StatisticsSet statistics = m_statisticsServices.getStatisticsSetFactory().create(); statistics.addSample(s_timedTestsIndex, 5); statistics.addValue(s_userDouble0Index, 1.5); final ThreadDataLogger ThreadDataLogger2 = new ThreadDataLogger( m_dataLogger, m_statisticsServices.getDetailStatisticsView().getExpressionViews(), 33); ThreadDataLogger2.report(11, m_test3, 530L, statistics); verify(m_dataLogger).info(eq("33, 11, 3, 530, 5, 0, 1.5"), m_argumentCaptor.capture()); }