From 112687463c730977b5384d19368d5215e16c29ec Mon Sep 17 00:00:00 2001 From: Fulminazzo Date: Wed, 17 Apr 2024 11:30:05 +0200 Subject: [PATCH] Added tests for openGUIAction --- .../test/java/it/angrybear/yagl/GUIAdapterTest.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/gui/bukkit/src/test/java/it/angrybear/yagl/GUIAdapterTest.java b/gui/bukkit/src/test/java/it/angrybear/yagl/GUIAdapterTest.java index bcdf042d..654b4c85 100644 --- a/gui/bukkit/src/test/java/it/angrybear/yagl/GUIAdapterTest.java +++ b/gui/bukkit/src/test/java/it/angrybear/yagl/GUIAdapterTest.java @@ -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; @@ -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))); }