add tests for GreetingController

This commit is contained in:
Denis Savosin
2024-09-25 11:24:30 +07:00
parent 6cfc4382d4
commit 208b2a604b
3 changed files with 47 additions and 7 deletions

View File

@@ -1,8 +1,7 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
id("org.springframework.boot") version "3.2.4"
id("io.spring.dependency-management") version "1.1.4"
jacoco
kotlin("jvm") version "2.0.20"
kotlin("plugin.jpa") version "1.9.23"
kotlin("plugin.serialization") version "2.0.20"
@@ -34,13 +33,22 @@ dependencies {
testImplementation("org.springframework.boot:spring-boot-starter-test")
}
tasks.withType<KotlinCompile> {
kotlinOptions {
freeCompilerArgs += "-Xjsr305=strict"
jvmTarget = "17"
kotlin {
compilerOptions {
freeCompilerArgs.addAll("-Xjsr305=strict")
apiVersion.set(org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_7)
}
}
tasks.withType<Test> {
useJUnitPlatform()
}
tasks.test {
finalizedBy(tasks.jacocoTestReport) // report is always generated after tests run
}
tasks.jacocoTestReport {
dependsOn(tasks.test) // tests are required to run before generating the report
}