<commit_before>package guitests;

import junit.framework.Assert;
import org.junit.Test;
import ui.UI;
import ui.issuepanel.IssuePanel;
import util.PlatformEx;
import util.events.UILogicRefreshEvent;
import util.events.UpdateDummyRepoEvent;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

public class ModelUpdateUITest extends UITest {

    private final int EVENT_DELAY = 750;

    @Test
    @SuppressWarnings("unchecked")
    public void addIssueTest() throws InterruptedException, ExecutionException {
        UI.events.triggerEvent(new UpdateDummyRepoEvent(UpdateDummyRepoEvent.UpdateType.RESET_REPO, "dummy/dummy"));
        UI.events.triggerEvent(new UILogicRefreshEvent());
        sleep(EVENT_DELAY);
        UI.events.triggerEvent(new UpdateDummyRepoEvent(UpdateDummyRepoEvent.UpdateType.NEW_ISSUE, "dummy/dummy"));
        UI.events.triggerEvent(new UILogicRefreshEvent());
        sleep(EVENT_DELAY);
        FutureTask countIssues = new FutureTask(((IssuePanel) find("#dummy/dummy_col0"))::getIssueCount);
        PlatformEx.runAndWait(countIssues);
        Assert.assertEquals(11, countIssues.get());
    }

    @Test
    @SuppressWarnings("unchecked")
    public void addMultipleIssuesTest() throws InterruptedException, ExecutionException {
        UI.events.triggerEvent(new UpdateDummyRepoEvent(UpdateDummyRepoEvent.UpdateType.RESET_REPO, "dummy/dummy"));
        UI.events.triggerEvent(new UILogicRefreshEvent());
        sleep(EVENT_DELAY);
        UI.events.triggerEvent(new UpdateDummyRepoEvent(UpdateDummyRepoEvent.UpdateType.NEW_ISSUE, "dummy/dummy"));
        UI.events.triggerEvent(new UILogicRefreshEvent());
        sleep(EVENT_DELAY);
        UI.events.triggerEvent(new UpdateDummyRepoEvent(UpdateDummyRepoEvent.UpdateType.NEW_ISSUE, "dummy/dummy"));
        UI.events.triggerEvent(new UILogicRefreshEvent());
        sleep(EVENT_DELAY);
        UI.events.triggerEvent(new UpdateDummyRepoEvent(UpdateDummyRepoEvent.UpdateType.NEW_ISSUE, "dummy/dummy"));
        UI.events.triggerEvent(new UILogicRefreshEvent());
        sleep(EVENT_DELAY);
        FutureTask countIssues = new FutureTask(((IssuePanel) find("#dummy/dummy_col0"))::getIssueCount);
        PlatformEx.runAndWait(countIssues);
        Assert.assertEquals(13, countIssues.get());
    }

    @Test
    @SuppressWarnings("unchecked")
    public void countIssuesTest() throws InterruptedException, ExecutionException {
        UI.events.triggerEvent(new UpdateDummyRepoEvent(UpdateDummyRepoEvent.UpdateType.NEW_ISSUE, "dummy/dummy"));
        UI.events.triggerEvent(new UILogicRefreshEvent());
        sleep(EVENT_DELAY);
        UI.events.triggerEvent(new UpdateDummyRepoEvent(UpdateDummyRepoEvent.UpdateType.RESET_REPO, "dummy/dummy"));
        UI.events.triggerEvent(new UILogicRefreshEvent());
        sleep(EVENT_DELAY);
        FutureTask countIssues = new FutureTask(((IssuePanel) find("#dummy/dummy_col0"))::getIssueCount);
        PlatformEx.runAndWait(countIssues);
        Assert.assertEquals(10, countIssues.get());
    }
}<commit_msg>extracted resetRepo, addIssue and deleteIssue methods in ModelUpdateUITest<commit_after>package guitests;

import org.junit.Assert;
import org.junit.Test;
import ui.UI;
import ui.issuepanel.IssuePanel;
import util.PlatformEx;
import util.events.UILogicRefreshEvent;
import util.events.UpdateDummyRepoEvent;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

public class ModelUpdateUITest extends UITest {

    private final int EVENT_DELAY = 1000;

    @Test
    @SuppressWarnings("unchecked")
    public void addIssueTest() throws InterruptedException, ExecutionException {
        resetRepo();
        addIssue();
        FutureTask countIssues = new FutureTask(((IssuePanel) find("#dummy/dummy_col0"))::getIssueCount);
        PlatformEx.runAndWait(countIssues);
        Assert.assertEquals(11, countIssues.get());
    }

    @Test
    @SuppressWarnings("unchecked")
    public void addMultipleIssuesTest() throws InterruptedException, ExecutionException {
        resetRepo();
        addIssue();
        addIssue();
        addIssue();
        FutureTask countIssues = new FutureTask(((IssuePanel) find("#dummy/dummy_col0"))::getIssueCount);
        PlatformEx.runAndWait(countIssues);
        Assert.assertEquals(13, countIssues.get());
    }

    @Test
    @SuppressWarnings("unchecked")
    public void countIssuesTest() throws InterruptedException, ExecutionException {
        addIssue();
        resetRepo();
        FutureTask countIssues = new FutureTask(((IssuePanel) find("#dummy/dummy_col0"))::getIssueCount);
        PlatformEx.runAndWait(countIssues);
        Assert.assertEquals(10, countIssues.get());
    }

//    @Test
//    @SuppressWarnings("unchecked")
//    public void deleteIssueTest() throws InterruptedException, ExecutionException {
//        resetRepo();
//        addIssue();
//        addIssue();
//        deleteIssue();
//        FutureTask countIssues = new FutureTask(((IssuePanel) find("#dummy/dummy_col0"))::getIssueCount);
//        PlatformEx.runAndWait(countIssues);
//        Assert.assertEquals(11, countIssues.get());
//    }
//
//    @Test
//    @SuppressWarnings("unchecked")
//    public void deleteMultipleIssuesTest() throws InterruptedException, ExecutionException {
//        resetRepo();
//        addIssue();
//        addIssue();
//        addIssue();
//        deleteIssue();
//        deleteIssue();
//        FutureTask countIssues = new FutureTask(((IssuePanel) find("#dummy/dummy_col0"))::getIssueCount);
//        PlatformEx.runAndWait(countIssues);
//        Assert.assertEquals(11, countIssues.get());
//    }

    public void resetRepo() {
        UI.events.triggerEvent(new UpdateDummyRepoEvent(UpdateDummyRepoEvent.UpdateType.RESET_REPO, "dummy/dummy"));
        UI.events.triggerEvent(new UILogicRefreshEvent());
        sleep(EVENT_DELAY);
    }

    public void addIssue() {
        UI.events.triggerEvent(new UpdateDummyRepoEvent(UpdateDummyRepoEvent.UpdateType.NEW_ISSUE, "dummy/dummy"));
        UI.events.triggerEvent(new UILogicRefreshEvent());
        sleep(EVENT_DELAY);
    }

    public void deleteIssue() {
        UI.events.triggerEvent(new UpdateDummyRepoEvent(UpdateDummyRepoEvent.UpdateType.DELETE_ISSUE, "dummy/dummy"));
        UI.events.triggerEvent(new UILogicRefreshEvent());
        sleep(EVENT_DELAY);
    }
}
{'fraction_non_alphanumeric': 0.11718871746922238, 'fraction_numerical': 0.004830917874396135, 'mean_word_length': 3.94834232845027, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '816307', 'n_tokens_mistral': 1888, 'n_tokens_neox': 1857, 'n_words': 288}