<commit_before>// Copyright © 2011, <NAME> <www.orfjackal.net>
// This software is released under the Apache License 2.0.
// The license text is at http://www.apache.org/licenses/LICENSE-2.0

package fi.jumi.test;

import fi.jumi.launcher.JumiLauncher;
import org.junit.*;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;

public class RunningTestsTest {

    private static final int TIMEOUT = 2000;

    @Rule public final AppRunner app = new AppRunner();
    private final JumiLauncher launcher = app.launcher;

    @Test(timeout = TIMEOUT)
    public void suite_with_zero_tests() throws Exception {
        launcher.addToClassPath(TestEnvironment.getSampleClasses());
        launcher.setTestsToInclude("sample.notests.*Test");
        launcher.start();
        launcher.awaitSuiteFinished();

        assertThat("total tests", launcher.getTotalTests(), is(0));
    }

    @Test(timeout = TIMEOUT)
    public void suite_with_one_passing_test() throws Exception {
        launcher.addToClassPath(TestEnvironment.getSampleClasses());
        launcher.setTestsToInclude("sample.OnePassingTest");
        launcher.start();
        launcher.awaitSuiteFinished();

        assertThat("total tests", launcher.getTotalTests(), is(2)); // test class plus its one test method
        assertThat("passing tests", launcher.getPassingTests(), is(2));
        assertThat("failing tests", launcher.getFailingTests(), is(0));
    }

    @Ignore("not implemented")
    @Test(timeout = TIMEOUT)
    public void suite_with_one_failing_test() throws Exception {
        launcher.addToClassPath(TestEnvironment.getSampleClasses());
        launcher.setTestsToInclude("sample.OneFailingTest");
        launcher.start();
        launcher.awaitSuiteFinished();

        assertThat("total tests", launcher.getTotalTests(), is(2)); // test class plus its one test method
        assertThat("passing tests", launcher.getPassingTests(), is(1));
        assertThat("failing tests", launcher.getFailingTests(), is(1));
    }

    // TODO: passing & failing tests
    // TODO: reporting test names
    // TODO: reporting stack traces
}
<commit_msg>RunningTestsTest: "suite with one failing test" passes<commit_after>// Copyright © 2011, <NAME> <www.orfjackal.net>
// This software is released under the Apache License 2.0.
// The license text is at http://www.apache.org/licenses/LICENSE-2.0

package fi.jumi.test;

import fi.jumi.launcher.JumiLauncher;
import org.junit.*;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;

public class RunningTestsTest {

    private static final int TIMEOUT = 2000;

    @Rule public final AppRunner app = new AppRunner();
    private final JumiLauncher launcher = app.launcher;

    @Test(timeout = TIMEOUT)
    public void suite_with_zero_tests() throws Exception {
        launcher.addToClassPath(TestEnvironment.getSampleClasses());
        launcher.setTestsToInclude("sample.notests.*Test");
        launcher.start();
        launcher.awaitSuiteFinished();

        assertThat("total tests", launcher.getTotalTests(), is(0));
    }

    @Test(timeout = TIMEOUT)
    public void suite_with_one_passing_test() throws Exception {
        launcher.addToClassPath(TestEnvironment.getSampleClasses());
        launcher.setTestsToInclude("sample.OnePassingTest");
        launcher.start();
        launcher.awaitSuiteFinished();

        assertThat("total tests", launcher.getTotalTests(), is(2)); // test class plus its one test method
        assertThat("passing tests", launcher.getPassingTests(), is(2));
        assertThat("failing tests", launcher.getFailingTests(), is(0));
    }

    @Test(timeout = TIMEOUT)
    public void suite_with_one_failing_test() throws Exception {
        launcher.addToClassPath(TestEnvironment.getSampleClasses());
        launcher.setTestsToInclude("sample.OneFailingTest");
        launcher.start();
        launcher.awaitSuiteFinished();

        assertThat("total tests", launcher.getTotalTests(), is(2)); // test class plus its one test method
        assertThat("passing tests", launcher.getPassingTests(), is(1));
        assertThat("failing tests", launcher.getFailingTests(), is(1));
    }

    // TODO: passing & failing tests
    // TODO: reporting test names
    // TODO: reporting stack traces
}

{'fraction_non_alphanumeric': 0.11653615845232612, 'fraction_numerical': 0.008751727314601566, 'mean_word_length': 3.695135135135135, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, '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': '4626915', 'n_tokens_mistral': 1246, 'n_tokens_neox': 1225, 'n_words': 290}