<commit_before>package seedu.taskboss.model;

import static org.junit.Assert.assertEquals;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;

import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;

import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import seedu.taskboss.model.category.Category;
import seedu.taskboss.model.task.ReadOnlyTask;
import seedu.taskboss.model.task.Task;
import seedu.taskboss.testutil.TypicalTestTasks;

public class TaskBossTest {

    @Rule
    public ExpectedException thrown = ExpectedException.none();

    private final TaskBoss taskBoss = new TaskBoss();

    @Test
    public void constructor() {
        assertEquals(Collections.emptyList(), taskBoss.getTaskList());
        assertEquals(Collections.emptyList(), taskBoss.getCategoryList());
    }

    @Test
    public void resetData_null_throwsAssertionError() {
        thrown.expect(AssertionError.class);
        taskBoss.resetData(null);
    }

    @Test
    public void resetData_withValidReadOnlyTaskBoss_replacesData() {
        TaskBoss newData = new TypicalTestTasks().getTypicalTaskBoss();
        taskBoss.resetData(newData);
        assertEquals(newData, taskBoss);
    }

    @Test
    public void resetData_withDuplicateTasks_throwsAssertionError() {
        TypicalTestTasks td = new TypicalTestTasks();
        // Repeat td.alice twice
        List<Task> newTasks = Arrays.asList(new Task(td.alice), new Task(td.alice));
        List<Category> newCategories = td.alice.getCategories().asObservableList();
        TaskBossStub newData = new TaskBossStub(newTasks, newCategories);

        thrown.expect(AssertionError.class);
        taskBoss.resetData(newData);
    }

    @Test
    public void resetData_withDuplicateCategories_throwsAssertionError() {
        TaskBoss typicalTaskBoss = new TypicalTestTasks().getTypicalTaskBoss();
        List<ReadOnlyTask> newTasks = typicalTaskBoss.getTaskList();
        List<Category> newCategories = new ArrayList<>(typicalTaskBoss.getCategoryList());
        // Repeat the first category twice
        newCategories.add(newCategories.get(0));
        TaskBossStub newData = new TaskBossStub(newTasks, newCategories);

        thrown.expect(AssertionError.class);
        taskBoss.resetData(newData);
    }

    /**
     * A stub ReadOnlyTaskBoss whose tasks and categories lists can violate interface constraints.
     */
    private static class TaskBossStub implements ReadOnlyTaskBoss {
        private final ObservableList<ReadOnlyTask> tasks = FXCollections.observableArrayList();
        private final ObservableList<Category> categories = FXCollections.observableArrayList();

        TaskBossStub(Collection<? extends ReadOnlyTask> tasks, Collection<? extends Category> categories) {
            this.tasks.setAll(tasks);
            this.categories.setAll(categories);
        }

        @Override
        public ObservableList<ReadOnlyTask> getTaskList() {
            return tasks;
        }

        @Override
        public ObservableList<Category> getCategoryList() {
            return categories;
        }
    }

}
<commit_msg>update TaskBossTest<commit_after>package seedu.taskboss.model;

import static org.junit.Assert.assertEquals;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;

import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;

import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import seedu.taskboss.model.category.Category;
import seedu.taskboss.model.task.ReadOnlyTask;
import seedu.taskboss.model.task.Task;
import seedu.taskboss.testutil.TypicalTestTasks;

public class TaskBossTest {

    @Rule
    public ExpectedException thrown = ExpectedException.none();

    private final TaskBoss taskBoss = new TaskBoss();

    @Test
    public void constructor() {
        assertEquals(Collections.emptyList(), taskBoss.getTaskList());
        assertEquals(Collections.emptyList(), taskBoss.getCategoryList());
    }

    @Test
    public void resetData_null_throwsAssertionError() {
        thrown.expect(AssertionError.class);
        taskBoss.resetData(null);
    }

    @Test
    public void resetData_withValidReadOnlyTaskBoss_replacesData() {
        TaskBoss newData = new TypicalTestTasks().getTypicalTaskBoss();
        taskBoss.resetData(newData);
        assertEquals(newData, taskBoss);
    }

    @Test
    public void resetData_withDuplicateTasks_throwsAssertionError() {
        TypicalTestTasks td = new TypicalTestTasks();
        // Repeat td.alice twice
        List<Task> newTasks = Arrays.asList(new Task(td.taskA), new Task(td.taskA));
        List<Category> newCategories = td.taskA.getCategories().asObservableList();
        TaskBossStub newData = new TaskBossStub(newTasks, newCategories);

        thrown.expect(AssertionError.class);
        taskBoss.resetData(newData);
    }

    @Test
    public void resetData_withDuplicateCategories_throwsAssertionError() {
        TaskBoss typicalTaskBoss = new TypicalTestTasks().getTypicalTaskBoss();
        List<ReadOnlyTask> newTasks = typicalTaskBoss.getTaskList();
        List<Category> newCategories = new ArrayList<>(typicalTaskBoss.getCategoryList());
        // Repeat the first category twice
        newCategories.add(newCategories.get(0));
        TaskBossStub newData = new TaskBossStub(newTasks, newCategories);

        thrown.expect(AssertionError.class);
        taskBoss.resetData(newData);
    }

    /**
     * A stub ReadOnlyTaskBoss whose tasks and categories lists can violate interface constraints.
     */
    private static class TaskBossStub implements ReadOnlyTaskBoss {
        private final ObservableList<ReadOnlyTask> tasks = FXCollections.observableArrayList();
        private final ObservableList<Category> categories = FXCollections.observableArrayList();

        TaskBossStub(Collection<? extends ReadOnlyTask> tasks, Collection<? extends Category> categories) {
            this.tasks.setAll(tasks);
            this.categories.setAll(categories);
        }

        @Override
        public ObservableList<ReadOnlyTask> getTaskList() {
            return tasks;
        }

        @Override
        public ObservableList<Category> getCategoryList() {
            return categories;
        }
    }

}

{'fraction_non_alphanumeric': 0.09088108441158349, 'fraction_numerical': 0.00030807147258163895, 'mean_word_length': 3.5405594405594405, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, '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': '2363725', 'n_tokens_mistral': 1817, 'n_tokens_neox': 1790, 'n_words': 355}