From 236203e0c38a98e954b7888d470ffaf76cee632a Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Fri, 5 Dec 2025 18:09:13 +0100 Subject: [PATCH] =?utf8?q?=E2=AC=86=EF=B8=8F=20Update=20dependencies=20for?= =?utf8?q?=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- build.gradle | 9 +++++---- .../kotlin/net/pterodactylus/util/test/DisableLog4jLogging.kt | 4 ++-- .../net/pterodactylus/util/test/DisableLog4jLoggingTest.kt | 7 ++++--- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/build.gradle b/build.gradle index 7f547d9..cfbc2ee 100644 --- a/build.gradle +++ b/build.gradle @@ -57,10 +57,11 @@ dependencies { implementation group: "org.jetbrains.kotlinx", name: "kotlinx-html-jvm", version: "0.11.0" implementation group: 'org.jspecify', name: 'jspecify', version: '1.0.0' - testImplementation(platform("org.junit:junit-bom:5.11.3")) - testImplementation group: "org.junit.jupiter", name: "junit-jupiter-engine" - testImplementation group: "org.hamcrest", name: "hamcrest", version: "2.2" - testImplementation group: "org.mockito", name: "mockito-core", version: "5.11.0" + testImplementation(platform('org.junit:junit-bom:6.0.1')) + testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter' + testRuntimeOnly group: 'org.junit.platform', name: 'junit-platform-launcher' + testImplementation group: 'org.hamcrest', name: 'hamcrest', version: '3.0' + testImplementation group: 'org.mockito.kotlin', name: 'mockito-kotlin', version: '6.1.0' testImplementation group: "com.spotify", name: "hamcrest-jackson", version: "1.3.2" } diff --git a/src/test/kotlin/net/pterodactylus/util/test/DisableLog4jLogging.kt b/src/test/kotlin/net/pterodactylus/util/test/DisableLog4jLogging.kt index e2519f3..9377b51 100644 --- a/src/test/kotlin/net/pterodactylus/util/test/DisableLog4jLogging.kt +++ b/src/test/kotlin/net/pterodactylus/util/test/DisableLog4jLogging.kt @@ -23,12 +23,12 @@ annotation class DisableLog4jLogging class DisableLog4jLoggingExtension : BeforeEachCallback, AfterEachCallback { - override fun beforeEach(context: ExtensionContext?) { + override fun beforeEach(context: ExtensionContext) { oldLevel = rootLogger.level Configurator.setLevel(rootLogger, Level.OFF) } - override fun afterEach(context: ExtensionContext?) { + override fun afterEach(context: ExtensionContext) { Configurator.setLevel(rootLogger, oldLevel) } diff --git a/src/test/kotlin/net/pterodactylus/util/test/DisableLog4jLoggingTest.kt b/src/test/kotlin/net/pterodactylus/util/test/DisableLog4jLoggingTest.kt index c16f244..4e3e77a 100644 --- a/src/test/kotlin/net/pterodactylus/util/test/DisableLog4jLoggingTest.kt +++ b/src/test/kotlin/net/pterodactylus/util/test/DisableLog4jLoggingTest.kt @@ -6,21 +6,22 @@ import org.apache.logging.log4j.core.config.Configurator import org.hamcrest.MatcherAssert.assertThat import org.hamcrest.Matchers.equalTo import org.junit.jupiter.api.Test +import org.mockito.Mockito.mock class DisableLog4jLoggingTest { @Test fun `extension disables logging on root logger`() { Configurator.setLevel(rootLogger, Level.ALL) - extension.beforeEach(null) + extension.beforeEach(mock()) assertThat(rootLogger.level, equalTo(Level.OFF)) } @Test fun `extension restores level of root logger after test`() { Configurator.setLevel(rootLogger, Level.forName("test", 123)) - extension.beforeEach(null) - extension.afterEach(null) + extension.beforeEach(mock()) + extension.afterEach(mock()) assertThat(rootLogger.level.intLevel(), equalTo(123)) } -- 2.7.4