### Question:
Collector { public void printReport(PrintWriter out) { this.printGlobalStats(out); out.println(); this.printServiceHeader(out); for(ServiceCollector serviceCollector : getServiceCollectors()) { this.printServiceStats(serviceCollector, out); } }  void setSearchString(String searchString); void setSortColumn(SortColumn sortFlag); void setSortOrder(SortOrder sortOrder); Collector.SortColumn getSortColumn(); String getSearchString(); static void setDurationsMs(boolean durationsMs); static boolean getDurationsMs(); void addLog(String logMessage); Date getStartTime(); LogMessage getFirstValidLogMessage(); LogMessage getLastValidLogMessage(); Date getEndTime(); long getDuration(); String getFormattedDuration(); int getServiceCount(); Map<String, ServiceCollector> getm_ServiceCollectors(); int compareLongs(long l1, long l2); Set<String> getServices(); List<ServiceCollector> getServiceCollectors(); Comparator<ServiceCollector> getColumnComparator(); int getThreadCount(); int getCollectionsPerService(String serviceID); long getAverageCollectionTimePerService(String serviceID); long getTotalCollectionTimePerService(String serviceID); void readLogMessagesFromFile(String fileName); void printGlobalStats(PrintWriter out); static String formatDuration(long millis); void printServiceHeader(PrintWriter out); void printReport(PrintWriter out); void printServiceStats(String serviceID, PrintWriter out); static final String SERVICE_TITLE_FORMAT; static final String SERVICE_DATA_FORMAT; }### Answer:
@Ignore @Test public void testPrintReport() throws IOException{ Collector c = new Collector(); c.readLogMessagesFromFile("TestLogFile.log"); StringWriter out = new StringWriter (); c.printReport(new PrintWriter(out,true)); String expectedOutput = fromFile("TestLogFile.out"); String actualOutput = out.toString(); assertEquals(expectedOutput,actualOutput); }