package de.duehl.vocabulary.japanese.data;

import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.*;

import java.util.ArrayList;
import java.util.List;

public class KanjiSetTest {

    @Test
    public void sort1() {
        KanjiSet set1 = new KanjiSet("Marogoto A2E1 Kapitel 05");
        set1.setGroup("Marogoto Kapitel");

        KanjiSet set2 = new KanjiSet("Marogoto A2E1 Kapitel 06");
        set2.setGroup("Marogoto Kapitel");

        List<KanjiSet> kanjiSet = new ArrayList<>();
        kanjiSet.add(set1);
        kanjiSet.add(set2);

        KanjiSet.sort(kanjiSet);

        assertEquals(set1, kanjiSet.get(0));
        assertEquals(set2, kanjiSet.get(1));
    }

    @Test
    public void sort2() {
        KanjiSet set1 = new KanjiSet("Marogoto A2E1 Kapitel 06");
        set1.setGroup("Marogoto Kapitel");

        KanjiSet set2 = new KanjiSet("Marogoto A2E1 Kapitel 05");
        set2.setGroup("Marogoto Kapitel");

        List<KanjiSet> kanjiSet = new ArrayList<>();
        kanjiSet.add(set2);
        kanjiSet.add(set1);

        KanjiSet.sort(kanjiSet);

        assertEquals(set2, kanjiSet.get(0));
        assertEquals(set1, kanjiSet.get(1));
    }

    @Test
    public void sort3() {
        KanjiSet set1 = new KanjiSet("Marogoto A2E1 Kapitel 16");
        set1.setGroup("Marugoto Kapitel");

        KanjiSet set2 = new KanjiSet("Marogoto A2E1 Kapitel 17");
        set2.setGroup("Marugoto Kapitel");

        List<KanjiSet> kanjiSet = new ArrayList<>();
        kanjiSet.add(set1);
        kanjiSet.add(set2);

        KanjiSet.sort(kanjiSet);

        assertEquals(set1, kanjiSet.get(0));
        assertEquals(set2, kanjiSet.get(1));
    }

    @Test
    public void sort4() {
        KanjiSet set1 = new KanjiSet("Marogoto A2E1 Kapitel 17");
        set1.setGroup("Marugoto Kapitel");

        KanjiSet set2 = new KanjiSet("Marogoto A2E1 Kapitel 16");
        set2.setGroup("Marugoto Kapitel");

        List<KanjiSet> kanjiSet = new ArrayList<>();
        kanjiSet.add(set2);
        kanjiSet.add(set1);

        KanjiSet.sort(kanjiSet);

        assertEquals(set2, kanjiSet.get(0));
        assertEquals(set1, kanjiSet.get(1));
    }

}
