Commit 98097435 authored by Mathieu Féry (Mathius)'s avatar Mathieu Féry (Mathius)
Browse files

Sort Class and System constants

parent db9d870c
Pipeline #23374 failed with stages
in 2 minutes and 41 seconds
......@@ -5,6 +5,7 @@ import androidx.annotation.Nullable;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Random;
......@@ -85,6 +86,7 @@ public class DnDClass implements Serializable, Comparable<DnDClass> {
clas.add(ELF);
clas.add(DWARF);
clas.add(HALFLING);
Collections.sort(clas, DnDClass::compareTo);
classes = clas;
}
......
......@@ -5,6 +5,7 @@ import androidx.annotation.Nullable;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Random;
......@@ -70,6 +71,7 @@ public class DnDSystem implements Serializable, Comparable<DnDSystem> {
sys.add(moc);
sys.add(dd);
sys.add(lotfp);
Collections.sort(sys, DnDSystem::compareTo);
systems = sys;
}
......
......@@ -3,6 +3,7 @@ package fr.iutnantes.miar.dndgenerator.api.dnd;
import org.junit.Test;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import static org.junit.Assert.assertEquals;
......@@ -19,7 +20,7 @@ public class DnDClassTest {
classSorted.add(DnDClass.DWARF);
classSorted.add(DnDClass.FIGHTER);
assertNotEquals(classSorted, classUnSorted);
classUnSorted.sort(DnDClass::compareTo);
Collections.sort(classUnSorted, DnDClass::compareTo);
assertEquals(classSorted, classUnSorted);
}
}
......@@ -3,6 +3,7 @@ package fr.iutnantes.miar.dndgenerator.api.dnd;
import org.junit.Test;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import static org.junit.Assert.*;
......@@ -23,7 +24,7 @@ public class DnDSystemTest {
systemsSorted.add(DnDSystem.lotfp);
systemsSorted.add(DnDSystem.lbb);
assertNotEquals(systemsSorted, systemsUnSorted);
systemsUnSorted.sort(DnDSystem::compareTo);
Collections.sort(systemsUnSorted, DnDSystem::compareTo);
assertEquals(systemsSorted, systemsUnSorted);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment