#909: Update tests to JUnit 5

By: DerFrZocker <derrieple@gmail.com>
This commit is contained in:
Bukkit/Spigot
2023-09-24 06:09:10 +10:00
parent eef02e5dd2
commit 2a6d2d27d7
50 changed files with 837 additions and 863 deletions

View File

@@ -1,10 +1,11 @@
package org.bukkit;
import static org.bukkit.support.MatcherAssert.*;
import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;
import static org.junit.jupiter.api.Assertions.*;
import com.google.common.collect.Lists;
import java.util.Collection;
import org.junit.Test;
import org.junit.jupiter.api.Test;
public class NoteTest {
@Test
@@ -51,24 +52,24 @@ public class NoteTest {
}
}
@Test(expected = IllegalArgumentException.class)
@Test
public void createNoteBelowMin() {
new Note((byte) -1);
assertThrows(IllegalArgumentException.class, () -> new Note((byte) -1));
}
@Test(expected = IllegalArgumentException.class)
@Test
public void createNoteAboveMax() {
new Note((byte) 25);
assertThrows(IllegalArgumentException.class, () -> new Note((byte) 25));
}
@Test(expected = IllegalArgumentException.class)
@Test
public void createNoteOctaveBelowMax() {
new Note((byte) -1, Note.Tone.A, true);
assertThrows(IllegalArgumentException.class, () -> new Note((byte) -1, Note.Tone.A, true));
}
@Test(expected = IllegalArgumentException.class)
@Test
public void createNoteOctaveAboveMax() {
new Note((byte) 3, Note.Tone.A, true);
assertThrows(IllegalArgumentException.class, () -> new Note((byte) 3, Note.Tone.A, true));
}
@Test
@@ -114,9 +115,9 @@ public class NoteTest {
assertEquals(note.getOctave(), 2);
}
@Test(expected = IllegalArgumentException.class)
@Test
public void testSharpWrapping2() {
new Note(2, Note.Tone.F, true).sharped();
assertThrows(IllegalArgumentException.class, () -> new Note(2, Note.Tone.F, true).sharped());
}
@Test