Repository: microsoft/gctoolkit
File: parser/src/test/java/com/microsoft/gctoolkit/parser/unittests/ParserTest.java (Java)

Code before:
        GCLogFile logfile = loadLogFile(path, true);
        Diarizer jvmConfiguration = getJVMConfiguration(logfile);
        GenerationalHeapParser generationalHeapParser = new GenerationalHeapParser();
        TestResults testResults = new TestResults();
        generationalHeapParser.publishTo(testResults);
        generationalHeapParser.diary(jvmConfiguration.getDiary());
        logfile.stream().map(String::trim).forEach(generationalHeapParser::receive);
        return testResults;
    }

    TestResults testGenerationalSingleLogFile(Path path) throws IOException {
        GCLogFile logfile = loadLogFile(path, false);
        Diarizer jvmConfiguration = getJVMConfiguration(logfile);
        GCLogParser generationalHeapParser = (jvmConfiguration.getDiary().isUnifiedLogging()) ? new UnifiedGenerationalParser() : new GenerationalHeapParser();
        TestResults testResults = new TestResults();
        generationalHeapParser.publishTo(testResults);
        generationalHeapParser.diary(jvmConfiguration.getDiary());
        logfile.stream().map(String::trim).forEach(generationalHeapParser::receive);
        return testResults;
    }

    TestResults testUnifiedG1GCSingleFile(Path path) throws IOException {
        SingleGCLogFile logfile = new SingleGCLogFile(path);
        Diarizer jvmConfiguration = getJVMConfiguration(logfile);
        UnifiedG1GCParser parser = new UnifiedG1GCParser();
        TestResults testResults = new TestResults();  // dick sites  google/dec light weight monitoring system ---> graphical idiams for looking for locks and lock contention
        parser.publishTo(testResults);
        parser.diary(jvmConfiguration.getDiary());
        logfile.stream().map(String::trim).forEach(parser::receive);
        return testResults;
    }

    TestResults testRegionalRotatingLogFile(Path path) throws IOException {
        GCLogFile logfile = loadLogFile(path, true);
        Diarizer jvmConfiguration = getJVMConfiguration(logfile);
        logfile.stream().map(String::trim).forEach(jvmConfiguration::diarize);
        PreUnifiedG1GCParser parser = new PreUnifiedG1GCParser();
        TestResults testResults = new TestResults();
        parser.publishTo(testResults);
        parser.diary(jvmConfiguration.getDiary());
        logfile.stream().map(String::trim).forEach(parser::receive);
        return testResults;
    }

    TestResults testRegionalSingleLogFile(Path path) throws IOException {
        GCLogFile logfile = loadLogFile(path, false);
        Diarizer jvmConfiguration = getJVMConfiguration(logfile);
        PreUnifiedG1GCParser parser = new PreUnifiedG1GCParser();
        TestResults testResults = new TestResults();
        parser.publishTo(testResults);
        parser.diary(jvmConfiguration.getDiary());

Review comment (suggestion):
```suggestion
        TestResults testResults = new TestResults();
```

Code after:
        GCLogFile logfile = loadLogFile(path, true);
        Diarizer jvmConfiguration = getJVMConfiguration(logfile);
        GenerationalHeapParser generationalHeapParser = new GenerationalHeapParser();
        TestResults testResults = new TestResults();
        generationalHeapParser.publishTo(testResults);
        generationalHeapParser.diary(jvmConfiguration.getDiary());
        logfile.stream().map(String::trim).forEach(generationalHeapParser::receive);
        return testResults;
    }

    TestResults testGenerationalSingleLogFile(Path path) throws IOException {
        GCLogFile logfile = loadLogFile(path, false);
        Diarizer jvmConfiguration = getJVMConfiguration(logfile);
        GCLogParser generationalHeapParser = (jvmConfiguration.getDiary().isUnifiedLogging()) ? new UnifiedGenerationalParser() : new GenerationalHeapParser();
        TestResults testResults = new TestResults();
        generationalHeapParser.publishTo(testResults);
        generationalHeapParser.diary(jvmConfiguration.getDiary());
        logfile.stream().map(String::trim).forEach(generationalHeapParser::receive);
        return testResults;
    }

    TestResults testUnifiedG1GCSingleFile(Path path) throws IOException {
        SingleGCLogFile logfile = new SingleGCLogFile(path);
        Diarizer jvmConfiguration = getJVMConfiguration(logfile);
        UnifiedG1GCParser parser = new UnifiedG1GCParser();
        TestResults testResults = new TestResults();
        parser.publishTo(testResults);
        parser.diary(jvmConfiguration.getDiary());
        logfile.stream().map(String::trim).forEach(parser::receive);
        return testResults;
    }

    TestResults testRegionalRotatingLogFile(Path path) throws IOException {
        GCLogFile logfile = loadLogFile(path, true);
        Diarizer jvmConfiguration = getJVMConfiguration(logfile);
        logfile.stream().map(String::trim).forEach(jvmConfiguration::diarize);
        PreUnifiedG1GCParser parser = new PreUnifiedG1GCParser();
        TestResults testResults = new TestResults();
        parser.publishTo(testResults);
        parser.diary(jvmConfiguration.getDiary());
        logfile.stream().map(String::trim).forEach(parser::receive);
        return testResults;
    }

    TestResults testRegionalSingleLogFile(Path path) throws IOException {
        GCLogFile logfile = loadLogFile(path, false);
        Diarizer jvmConfiguration = getJVMConfiguration(logfile);
        PreUnifiedG1GCParser parser = new PreUnifiedG1GCParser();
        TestResults testResults = new TestResults();
        parser.publishTo(testResults);
        parser.diary(jvmConfiguration.getDiary());