Skip to content

Commit

Permalink
Added tests for multiple different types of GUIs
Browse files Browse the repository at this point in the history
  • Loading branch information
fulminazzo committed Apr 12, 2024
1 parent 165712c commit c339a56
Showing 1 changed file with 23 additions and 5 deletions.
28 changes: 23 additions & 5 deletions gui/bukkit/src/test/java/it/angrybear/yagl/GUIAdapterTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import it.angrybear.yagl.contents.GUIContent;
import it.angrybear.yagl.contents.ItemGUIContent;
import it.angrybear.yagl.guis.GUI;
import it.angrybear.yagl.guis.GUIType;
import it.angrybear.yagl.items.Item;
import it.angrybear.yagl.utils.GUITestUtils;
import it.angrybear.yagl.viewers.PlayerOfflineException;
Expand All @@ -17,6 +18,8 @@
import org.jetbrains.annotations.NotNull;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;

import java.util.List;
import java.util.UUID;
Expand Down Expand Up @@ -44,11 +47,26 @@ void setUp() {
});
}

@Test
void testOpenGUI() {
GUI expected = GUI.newGUI(9)
.setTitle("Hello world")
.addContent(Item.newItem("stone").setDisplayName("test"));
private static GUI[] guis() {
return new GUI[]{
GUI.newGUI(9)
.setTitle("Hello world")
.addContent(Item.newItem("stone").setDisplayName("test")),
GUI.newGUI(9)
.setTitle(null)
.addContent(Item.newItem("stone").setDisplayName("test")),
GUI.newGUI(GUIType.CHEST)
.setTitle("Hello world")
.addContent(Item.newItem("stone").setDisplayName("test")),
GUI.newGUI(GUIType.CHEST)
.setTitle(null)
.addContent(Item.newItem("stone").setDisplayName("test")),
};
}

@ParameterizedTest
@MethodSource("guis")
void testOpenGUI(GUI expected) {
openGUI(expected);

assertNotNull(this.inventory);
Expand Down

0 comments on commit c339a56

Please sign in to comment.