<commit_before>package guitests;

import backend.interfaces.RepoStore;
import com.google.common.util.concurrent.SettableFuture;
import javafx.scene.Parent;
import javafx.stage.Stage;
import org.junit.Before;
import org.loadui.testfx.GuiTest;
import org.loadui.testfx.utils.FXTestUtils;
import prefs.Preferences;
import ui.UI;

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.concurrent.TimeUnit;

import static com.google.common.io.Files.getFileExtension;

public class UITest extends GuiTest {

    private static final SettableFuture<Stage> stageFuture = SettableFuture.create();

    protected static class TestUI extends UI {
        public TestUI() {
            super();
        }

        @Override
        public void start(Stage primaryStage) {
            super.start(primaryStage);
            stageFuture.set(primaryStage);
        }
    }

    public void setupMethod() {
        // method to be overridden if anything needs to be done (e.g. to the json) before the stage starts
    }

    public void clearTestFolder() {
        try {
            Files.walk(Paths.get(RepoStore.TEST_DIRECTORY), 1)
                    .filter(Files::isRegularFile)
                    .filter(p -> getFileExtension(String.valueOf(p.getFileName())).equalsIgnoreCase("json"))
                    .forEach(p -> new File(p.toAbsolutePath().toString()).delete());<commit_msg>changed stageFuture to protected in UITest<commit_after>package guitests;

import backend.interfaces.RepoStore;
import com.google.common.util.concurrent.SettableFuture;
import javafx.scene.Parent;
import javafx.stage.Stage;
import org.junit.Before;
import org.loadui.testfx.GuiTest;
import org.loadui.testfx.utils.FXTestUtils;
import prefs.Preferences;
import ui.UI;

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.concurrent.TimeUnit;

import static com.google.common.io.Files.getFileExtension;

public class UITest extends GuiTest {

    protected static final SettableFuture<Stage> stageFuture = SettableFuture.create();

    protected static class TestUI extends UI {
        public TestUI() {
            super();
        }

        @Override
        public void start(Stage primaryStage) {
            super.start(primaryStage);
            stageFuture.set(primaryStage);
        }
    }

    public void setupMethod() {
        // method to be overridden if anything needs to be done (e.g. to the json) before the stage starts
    }

    public void clearTestFolder() {
        try {
            Files.walk(Paths.get(RepoStore.TEST_DIRECTORY), 1)
                    .filter(Files::isRegularFile)
                    .filter(p -> getFileExtension(String.valueOf(p.getFileName())).equalsIgnoreCase("json"))
                    .forEach(p -> new File(p.toAbsolutePath().toString()).delete());
{'fraction_non_alphanumeric': 0.10367318915207689, 'fraction_numerical': 0.0006865774116031583, 'mean_word_length': 2.9592391304347827, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '3292184', 'n_tokens_mistral': 829, 'n_tokens_neox': 807, 'n_words': 190}