Skip to content

Commit

Permalink
Added tests for null openGUIViewer
Browse files Browse the repository at this point in the history
  • Loading branch information
fulminazzo committed Apr 12, 2024
1 parent 69b8c69 commit 7dce789
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions gui/bukkit/src/test/java/it/angrybear/yagl/GUIManagerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,18 @@

class GUIManagerTest {

@Test
void testGetOpenGUIViewerUUID() {
BukkitUtils.setupServer();
try (MockedStatic<JavaPlugin> ignored = mockStatic(JavaPlugin.class)) {
JavaPlugin plugin = mock(JavaPlugin.class);
when(JavaPlugin.getProvidingPlugin(any())).thenAnswer(a -> plugin);
when(Bukkit.getPluginManager()).thenReturn(mock(PluginManager.class));

assertFalse(GUIManager.getOpenGUIViewer(UUID.randomUUID()).isPresent(), "Should not be present");
}
}

@Nested
class EventsTest {
private GUIManager guiManager;
Expand Down

0 comments on commit 7dce789

Please sign in to comment.