<commit_before>package de.tobiasroeser.lambdatest.generic;

import static de.tobiasroeser.lambdatest.internal.Util.find;

import java.util.LinkedList;
import java.util.List;
import java.util.regex.Pattern;

import de.tobiasroeser.lambdatest.Intercept;
import de.tobiasroeser.lambdatest.LambdaTest;
import de.tobiasroeser.lambdatest.Optional;
import de.tobiasroeser.lambdatest.Reporter;
import de.tobiasroeser.lambdatest.RunnableWithException;
import de.tobiasroeser.lambdatest.Section;

/**
 * Common base class containing framework agnostic implementation of
 * FreeSpec-like classes.
 * 
 * @see de.tobiasroeser.lambdatest.junit.FreeSpec
 * @see de.tobiasroeser.lambdatest.testng.FreeSpec
 */
public abstract class FreeSpecBase implements LambdaTest {

	private static final ThreadLocal<Section> sectionHolder = new ThreadLocal<Section>();

	private Reporter reporter = new LoggingWrappingReporter(new DefaultReporter());
	private final List<DefaultTestCase> testCases = new LinkedList<>();
	private String suiteName = getClass().getName();
	private boolean expectFailFast;
	private boolean runInParallel = false;

	public boolean getRunInParallel() {
		return runInParallel;
	}

	@Override
	public void setRunInParallel(final boolean runInParallel) {<commit_msg>Added static default reporter field and support methods<commit_after>package de.tobiasroeser.lambdatest.generic;

import static de.tobiasroeser.lambdatest.internal.Util.find;

import java.util.LinkedList;
import java.util.List;
import java.util.regex.Pattern;

import de.tobiasroeser.lambdatest.Intercept;
import de.tobiasroeser.lambdatest.LambdaTest;
import de.tobiasroeser.lambdatest.Optional;
import de.tobiasroeser.lambdatest.Reporter;
import de.tobiasroeser.lambdatest.RunnableWithException;
import de.tobiasroeser.lambdatest.Section;

/**
 * Common base class containing framework agnostic implementation of
 * FreeSpec-like classes.
 * 
 * @see de.tobiasroeser.lambdatest.junit.FreeSpec
 * @see de.tobiasroeser.lambdatest.testng.FreeSpec
 */
public abstract class FreeSpecBase implements LambdaTest {

	private static final ThreadLocal<Section> sectionHolder = new ThreadLocal<Section>();

	private static Reporter defaultReporter = new LoggingWrappingReporter(new DefaultReporter());

	public static Reporter getDefaultReporter() {
		return defaultReporter;
	}

	public static void setDefaultReporter(final Reporter reporter) {
		defaultReporter = reporter;
	}

	public interface F0WithException<R> {
		public R apply() throws Exception;
	}

	public static <T> T withDefaultReporter(final Reporter reporter, final F0WithException<T> f) throws Exception {
		final Reporter defRep = getDefaultReporter();
		try {
			setDefaultReporter(reporter);
			return f.apply();
		} finally {
			setDefaultReporter(defRep);
		}
	}

	private Reporter reporter = defaultReporter;
	private final List<DefaultTestCase> testCases = new LinkedList<>();
	private String suiteName = getClass().getName();
	private boolean expectFailFast;
	private boolean runInParallel = false;

	public boolean getRunInParallel() {
		return runInParallel;
	}

	@Override
	public void setRunInParallel(final boolean runInParallel) {
{'fraction_non_alphanumeric': 0.08496525584333543, 'fraction_numerical': 0.0006317119393556538, 'mean_word_length': 5.975770925110132, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '4230383', 'n_tokens_mistral': 997, 'n_tokens_neox': 989, 'n_words': 224}