<commit_before>package net.bolbat.utils.test;

import java.io.File;

import net.bolbat.utils.lang.StringUtils;

/**
 * Utility with some helping functionality.
 * 
 * @author <NAME>
 */
public final class TestUtils {

	/**
	 * Default constructor with preventing instantiations of this class.
	 */
	private TestUtils() {
		throw new IllegalAccessError("Shouldn't be instantiated.");
	}

	/**
	 * Get path to folder where temporary data can be stored.<br>
	 * Path always ends with path separator.
	 * 
	 * @param clazz
	 *            class, used to construct path suffix from class name, optional
	 * @return {@link String} path
	 */
	public static String getTemporaryFolder(final Class<?> clazz) {
		return getTemporaryFolder(clazz != null ? clazz.getName() : StringUtils.EMPTY);
	}

	/**
	 * Get path to folder where test can store some temporary data.<br>
	 * Path always ends with path separator.
	 * 
	 * @param suffix
	 *            path suffix, optional
	 * @return {@link String} path
	 */
	public static String getTemporaryFolder(final String suffix) {
		String result = System.getProperty("java.io.tmpdir"); // trying to obtain current system user temporary directory
		if (StringUtils.isEmpty(result)) // if temporary directory not exist/configured
			result = System.getProperty("user.home"); // trying to obtain current system user home directory
		if (StringUtils.isEmpty(result)) // if home directory not exist/configured
			result = File.separator + "tmp";
		if (StringUtils.isEmpty(suffix)) // if suffix is empty
			return result.endsWith(File.separator) ? result : result + File.separator;

		result += suffix.startsWith(File.separator) ? suffix : File.separator + suffix; // adding suffix
		return result.endsWith(File.separator) ? result : result + File.separator;
	}

}<commit_msg>Small improvement in TestUtils<commit_after>package net.bolbat.utils.test;

import java.io.File;

import net.bolbat.utils.lang.StringUtils;

/**
 * Utility with some helping functionality.
 * 
 * @author <NAME>
 */
public final class TestUtils {

	/**
	 * Default constructor with preventing instantiations of this class.
	 */
	private TestUtils() {
		throw new IllegalAccessError("Shouldn't be instantiated.");
	}

	/**
	 * Get path to folder where temporary data can be stored.<br>
	 * Path always ends with path separator.
	 * 
	 * @param clazz
	 *            class, used to construct path suffix from class name, optional
	 * @return {@link String} path
	 */
	public static String getTemporaryFolder(final Class<?> clazz) {
		return getTemporaryFolder(clazz != null ? clazz.getName() : StringUtils.EMPTY);
	}

	/**
	 * Get path to folder where test can store some temporary data.<br>
	 * Path always ends with path separator.
	 * 
	 * @param suffix
	 *            path suffix, optional
	 * @return {@link String} path
	 */
	public static String getTemporaryFolder(final String suffix) {
		String result = System.getProperty("java.io.tmpdir"); // trying to obtain current system user temporary directory
		if (StringUtils.isEmpty(result)) // if temporary directory not exist/configured
			result = System.getProperty("user.home"); // trying to obtain current system user home directory
		if (StringUtils.isEmpty(result)) // if home directory not exist/configured
			result = File.separator + "tmp";
		if (StringUtils.isEmpty(suffix)) // if suffix is empty
			return result.endsWith(File.separator) ? result : result + File.separator;

		if (result.endsWith(File.separator)) // removing redundant separator
			result = result.substring(0, result.length() - 1);

		result += suffix.startsWith(File.separator) ? suffix : File.separator + suffix; // adding suffix
		return result.endsWith(File.separator) ? result : result + File.separator;
	}

}
{'fraction_non_alphanumeric': 0.10781958900453696, 'fraction_numerical': 0.0005337603416066186, 'mean_word_length': 3.7144654088050313, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '2221367', 'n_tokens_mistral': 1094, 'n_tokens_neox': 991, 'n_words': 348}