<commit_before>package test.reports;

import org.testng.*;
import org.testng.annotations.Test;
import org.testng.xml.XmlSuite;
import org.testng.xml.XmlTest;
import test.SimpleBaseTest;

import java.util.List;

public class UniqueReporterInjectionTest extends SimpleBaseTest {
    @Test
    public void testPruningOfDuplicateReporter() {
        XmlSuite xmlSuite = createXmlSuite("Suite");
        XmlTest xmlTest = createXmlTest(xmlSuite, "Test");
        createXmlClass(xmlTest, UniqueReporterInjectionSample1.class);
        createXmlClass(xmlTest, UniqueReporterInjectionSample2.class);
        TestNG tng = create(xmlSuite);
        tng.setUseDefaultListeners(false);
        tng.addListener((ITestNGListener) new ReporterListenerForIssue1227());
        tng.run();
        Assert.assertTrue(tng.getReporters().size() == 1);
    }

    public static class ReporterListenerForIssue1227 implements IReporter {
        @Override
        public void generateReport(List<XmlSuite> xmlSuites, List<ISuite> suites, String outputDirectory) {}
    }
}
<commit_msg>Fixing additional review comments.<commit_after>package test.reports;

import org.testng.*;
import org.testng.annotations.Test;
import org.testng.xml.XmlSuite;
import org.testng.xml.XmlTest;
import test.SimpleBaseTest;

import java.util.List;

public class UniqueReporterInjectionTest extends SimpleBaseTest {
    @Test
    public void testPruningOfDuplicateReporter() {
        XmlSuite xmlSuite = createXmlSuite("Suite");
        XmlTest xmlTest = createXmlTest(xmlSuite, "Test");
        createXmlClass(xmlTest, UniqueReporterInjectionSample1.class);
        createXmlClass(xmlTest, UniqueReporterInjectionSample2.class);
        TestNG tng = create(xmlSuite);
        tng.setUseDefaultListeners(false);
        tng.addListener((ITestNGListener) new ReporterListenerForIssue1227());
        tng.run();
        Assert.assertEquals(tng.getReporters().size(),1);
        Assert.assertEquals(ReporterListenerForIssue1227.counter, 1);
    }

    public static class ReporterListenerForIssue1227 implements IReporter {
        static int counter = 0;
        @Override
        public void generateReport(List<XmlSuite> xmlSuites, List<ISuite> suites, String outputDirectory) {
            counter++;
        }
    }
}

{'fraction_non_alphanumeric': 0.09358523725834798, 'fraction_numerical': 0.012302284710017574, 'mean_word_length': 3.95, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 18}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5105454', 'n_tokens_mistral': 681, 'n_tokens_neox': 645, 'n_words': 127}