Skip to content

Commit

Permalink
WiP bump Junit
Browse files Browse the repository at this point in the history
  • Loading branch information
buchner committed Nov 14, 2024
1 parent 389d588 commit 3d68849
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 13 deletions.
3 changes: 0 additions & 3 deletions buildSrc/src/main/kotlin/Dependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@ import org.gradle.api.artifacts.dsl.DependencyHandler
object Libraries {
internal object Versions {
const val hamcrest = "2.2"
const val junit = "5.6.2"
const val kotlin = "1.5.0"
const val logback = "1.2.3"
}

const val hamcrest = "org.hamcrest:hamcrest:${Versions.hamcrest}"
const val hamcrestLibrary = "org.hamcrest:hamcrest-library:${Versions.hamcrest}"
const val junitApi = "org.junit.jupiter:junit-jupiter-api:${Versions.junit}"
const val kotlinReflect = "org.jetbrains.kotlin:kotlin-reflect:${Versions.kotlin}"
}

Expand All @@ -21,7 +19,6 @@ object TestLibraries {

const val hamcrest = Libraries.hamcrest
const val hamcrestLibrary = Libraries.hamcrestLibrary
const val junitJupiter = "org.junit.jupiter:junit-jupiter:${Libraries.Versions.junit}"
const val kotestRunner = "io.kotest:kotest-runner-junit5-jvm:${Versions.kotest}"
const val kotestProperty = "io.kotest:kotest-property:${Versions.kotest}"
const val kotestAssert = "io.kotest:kotest-assertions-core:${Versions.kotest}"
Expand Down
2 changes: 1 addition & 1 deletion core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ plugins {

dependencies {
implementation(kotlin("stdlib-jdk8"))
testImplementation(TestLibraries.junitJupiter)
testImplementation(libs.junit.jupiter)
testImplementHamcrest()
testImplementation(TestLibraries.kotlinReflect)
testImplementKotest()
Expand Down
2 changes: 1 addition & 1 deletion java-demo/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ dependencies {
testImplementation(project(":hamcrest-support"))
testImplementation(project(":slf4j-logback"))
testImplementHamcrest()
testImplementation(TestLibraries.junitJupiter)
testImplementation(libs.junit.jupiter)
}

tasks.test { configure<JacocoTaskExtension> { isEnabled = false } }
4 changes: 2 additions & 2 deletions junit5-support/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ plugins {
dependencies {
implementation(project(":core"))
implementation(kotlin("stdlib-jdk8"))
implementation(Libraries.junitApi)
testImplementation(TestLibraries.junitJupiter)
implementation(libs.junit.jupiterapi)
testImplementation(libs.junit.jupiter)
testImplementHamcrest()
testImplementation(TestLibraries.kotlinReflect)
testImplementKotest()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@ import org.hamcrest.CoreMatchers.`is`
import org.hamcrest.MatcherAssert.assertThat
import org.junit.jupiter.api.TestInstance.Lifecycle
import org.junit.jupiter.api.assertThrows
import org.junit.jupiter.api.extension.ExtensionContext
import org.junit.jupiter.api.extension.*
import org.junit.jupiter.api.extension.ExtensionContext.Namespace
import org.junit.jupiter.api.extension.ExtensionContext.Store
import org.junit.jupiter.api.extension.ParameterContext
import org.junit.jupiter.api.extension.ParameterResolutionException
import org.junit.jupiter.api.extension.TestInstances
import org.junit.jupiter.api.parallel.ExecutionMode
import org.junit.platform.commons.util.AnnotationUtils
import java.lang.reflect.AnnotatedElement
import java.lang.reflect.Method
Expand Down Expand Up @@ -215,6 +213,22 @@ internal class LogSpyExtensionTest : FreeSpec() {
ExtensionContext {
private val stores = mutableMapOf<Namespace, Store>()

override fun <T : Any?> getConfigurationParameter(
key: String?,
transformer: Function<String, T>?
): Optional<T> {
return Optional.empty<T & Any>()
}

override fun getExecutionMode(): ExecutionMode {
return ExecutionMode.SAME_THREAD
}

// TODO continue here
override fun getExecutableInvoker(): ExecutableInvoker {
TODO("Not yet implemented")
}

override fun getElement(): Optional<AnnotatedElement> {
return Optional.empty()
}
Expand Down
3 changes: 3 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ dependencyResolutionManagement {
versionCatalogs {
create("libs") {
plugin("ktlint", "org.jlleitschuh.gradle.ktlint").version("12.1.1")
version("junit", "5.11.3")
library("junit-jupiterapi", "org.junit.jupiter", "junit-jupiter-api").versionRef("junit")
library("junit-jupiter", "org.junit.jupiter", "junit-jupiter").versionRef("junit")
version("logback", "1.3.14")
library("logback-core", "ch.qos.logback", "logback-core").versionRef("logback")
library("logback-classic", "ch.qos.logback", "logback-classic").versionRef("logback")
Expand Down
2 changes: 1 addition & 1 deletion slf4j-logback/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ dependencies {
implementation(libs.logback.core)
testImplementation(project(":testing"))
testImplementation(project(":hamcrest-support"))
testImplementation(TestLibraries.junitJupiter)
testImplementation(libs.junit.jupiter)
testImplementHamcrest()
testImplementKotest()
}
2 changes: 1 addition & 1 deletion testing/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ dependencies {
implementation(project(":junit5-support"))
implementation(kotlin("stdlib-jdk8"))
implementation(project(":hamcrest-support"))
implementation(TestLibraries.junitJupiter)
implementation(libs.junit.jupiter)
implementation(TestLibraries.hamcrest)
implementation(TestLibraries.hamcrestLibrary)
implementation(libs.slf4j)
Expand Down

0 comments on commit 3d68849

Please sign in to comment.