diff --git a/src/test/java/net/dv8tion/jda/test/interactions/privileges/AbstractPrivilegeConfigTest.java b/src/test/java/net/dv8tion/jda/test/interactions/privileges/AbstractPrivilegeConfigTest.java index b0725b499d..7764f06a95 100644 --- a/src/test/java/net/dv8tion/jda/test/interactions/privileges/AbstractPrivilegeConfigTest.java +++ b/src/test/java/net/dv8tion/jda/test/interactions/privileges/AbstractPrivilegeConfigTest.java @@ -54,7 +54,6 @@ public abstract class AbstractPrivilegeConfigTest extends IntegrationTest @Mock protected PrivilegeConfig config; - protected MockedStatic privilegeHelperMock; protected MockedStatic commandLevelChannelMock; protected MockedStatic appLevelChannelMock; protected MockedStatic commandLevelUserRoleMock; @@ -79,7 +78,6 @@ void setupMocks() when(member.getIdLong()).thenReturn(Constants.MINN_USER_ID); when(member.getRoles()).thenReturn(Collections.singletonList(memberRole)); - privilegeHelperMock = mockStatic(PrivilegeHelper.class); commandLevelChannelMock = mockStatic(CommandLevelChannelPermissionChecks.class); appLevelChannelMock = mockStatic(AppLevelChannelPermissionChecks.class); commandLevelUserRoleMock = mockStatic(CommandLevelUserOrRolePermissionChecks.class); @@ -93,7 +91,6 @@ void teardownMocks() try { // Make sure all interactions were checked by the test subclasses - privilegeHelperMock.verifyNoMoreInteractions(); commandLevelChannelMock.verifyNoMoreInteractions(); appLevelChannelMock.verifyNoMoreInteractions(); commandLevelUserRoleMock.verifyNoMoreInteractions(); @@ -102,7 +99,6 @@ void teardownMocks() } finally { - privilegeHelperMock.close(); commandLevelChannelMock.close(); appLevelChannelMock.close(); commandLevelUserRoleMock.close(); diff --git a/src/test/java/net/dv8tion/jda/test/interactions/privileges/PrivilegeHelperPrivilegeTests.java b/src/test/java/net/dv8tion/jda/test/interactions/privileges/PrivilegeHelperPrivilegeTests.java index dc987eb6aa..9a9e069fd5 100644 --- a/src/test/java/net/dv8tion/jda/test/interactions/privileges/PrivilegeHelperPrivilegeTests.java +++ b/src/test/java/net/dv8tion/jda/test/interactions/privileges/PrivilegeHelperPrivilegeTests.java @@ -20,15 +20,37 @@ import net.dv8tion.jda.api.interactions.commands.DefaultMemberPermissions; import net.dv8tion.jda.internal.utils.interactions.commands.CommandLevelChannelPermissionChecks; import net.dv8tion.jda.internal.utils.interactions.commands.PrivilegeHelper; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; +import org.mockito.MockedStatic; import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.when; +import static org.mockito.Mockito.*; public class PrivilegeHelperPrivilegeTests extends AbstractPrivilegeConfigTest { + protected MockedStatic privilegeHelperMock; + + @BeforeEach + void setupPrivilegeHelper() + { + privilegeHelperMock = mockStatic(PrivilegeHelper.class); + } + + @AfterEach + void teardownPrivilegeHelper() + { + try + { + privilegeHelperMock.verifyNoMoreInteractions(); + } + finally + { + privilegeHelperMock.close(); + } + } @Test @DisplayName("Requires no permissions, forward to command level permission checks")