Skip to content

Commit

Permalink
Added tests for openGUIAction
Browse files Browse the repository at this point in the history
  • Loading branch information
fulminazzo committed Apr 17, 2024
1 parent 66543ba commit 1126874
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions gui/bukkit/src/test/java/it/angrybear/yagl/GUIAdapterTest.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package it.angrybear.yagl;

import it.angrybear.yagl.actions.GUIAction;
import it.angrybear.yagl.contents.GUIContent;
import it.angrybear.yagl.contents.ItemGUIContent;
import it.angrybear.yagl.guis.GUI;
Expand Down Expand Up @@ -136,6 +137,15 @@ void testCloseGUIForOfflinePlayer() {
assertThrowsExactly(PlayerOfflineException.class, this::closeGUI);
}

@Test
void testOpenGUIAction() {
GUI gui = GUI.newGUI(9);
GUIAction openAction = mock(GUIAction.class);
gui.onOpenGUI(openAction);
openGUI(gui);
verify(openAction).execute(GUIManager.getViewer(this.player), gui);
}

private void openGUI(GUI gui) {
GUITestUtils.mockPlugin(p -> gui.open(GUIManager.getViewer(this.player)));
}
Expand Down

0 comments on commit 1126874

Please sign in to comment.