Skip to content

Commit

Permalink
Flytt testkode til fellesmodul (#556)
Browse files Browse the repository at this point in the history
  • Loading branch information
bjerga authored Jun 10, 2024
1 parent ea846ed commit 0ca08ec
Show file tree
Hide file tree
Showing 18 changed files with 25 additions and 33 deletions.
1 change: 0 additions & 1 deletion api/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,4 @@ dependencies {
testImplementation("io.ktor:ktor-server-test-host:$ktorVersion")
testImplementation("io.lettuce:lettuce-core:$lettuceVersion")
testImplementation("no.nav.security:mock-oauth2-server:$mockOauth2ServerVersion")
testImplementation(project(":felles-test"))
}
9 changes: 2 additions & 7 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ subprojects {
)

tasks {
if (!project.erFellesModul() && !project.erFellesDatabaseModul() && !project.erFellesTestModul()) {
if (!project.erFellesModul() && !project.erFellesDatabaseModul()) {
named<Jar>("jar") {
archiveBaseName.set("app")

Expand Down Expand Up @@ -116,9 +116,7 @@ subprojects {
dependencies {
if (!erFellesModul()) {
implementation(project(":felles"))
}
if (!erFellesTestModul()) {
testImplementation(project(":felles-test"))
testImplementation(testFixtures(project(":felles")))
}

implementation("no.nav.helsearbeidsgiver:domene-inntektsmelding:$hagDomeneInntektsmeldingVersion")
Expand Down Expand Up @@ -272,9 +270,6 @@ fun Project.erFellesModul(): Boolean =
fun Project.erFellesDatabaseModul(): Boolean =
name == "felles-db-exposed"

fun Project.erFellesTestModul(): Boolean =
name == "felles-test"

fun List<String>.containsAny(vararg others: String): Boolean =
this.intersect(others.toSet()).isNotEmpty()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import io.kotest.matchers.nulls.shouldBeNull
import io.kotest.matchers.nulls.shouldNotBeNull
import io.kotest.matchers.shouldBe
import io.kotest.matchers.shouldNotBe
import no.nav.helsearbeidsgiver.felles.db.test.exposed.FunSpecWithDb
import no.nav.helsearbeidsgiver.felles.db.exposed.test.FunSpecWithDb
import no.nav.helsearbeidsgiver.inntektsmelding.db.tabell.ForespoerselEntitet
import no.nav.helsearbeidsgiver.inntektsmelding.db.tabell.InntektsmeldingEntitet
import org.jetbrains.exposed.sql.Database
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import io.kotest.matchers.shouldNotBe
import no.nav.helsearbeidsgiver.domene.inntektsmelding.v1.Inntekt
import no.nav.helsearbeidsgiver.domene.inntektsmelding.v1.Inntektsmelding
import no.nav.helsearbeidsgiver.domene.inntektsmelding.v1.Naturalytelse
import no.nav.helsearbeidsgiver.felles.db.test.exposed.FunSpecWithDb
import no.nav.helsearbeidsgiver.felles.db.exposed.test.FunSpecWithDb
import no.nav.helsearbeidsgiver.felles.test.mock.mockInntektsmeldingV1
import no.nav.helsearbeidsgiver.inntektsmelding.db.tabell.SelvbestemtInntektsmeldingEntitet
import no.nav.helsearbeidsgiver.utils.test.date.oktober
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package no.nav.helsearbeidsgiver.felles.db.test.exposed
package no.nav.helsearbeidsgiver.felles.db.exposed.test

import com.zaxxer.hikari.HikariConfig
import io.kotest.core.spec.style.FunSpec
Expand Down
18 changes: 0 additions & 18 deletions felles-test/build.gradle.kts

This file was deleted.

15 changes: 15 additions & 0 deletions felles/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,10 +1,25 @@
val kotestVersion: String by project
val lettuceVersion: String by project
val mockkVersion: String by project
val rapidsAndRiversVersion: String by project
val slf4jVersion: String by project
val utilsVersion: String by project

plugins {
id("java-test-fixtures")
}

dependencies {
api("com.github.navikt:rapids-and-rivers:$rapidsAndRiversVersion")
api("org.slf4j:slf4j-api:$slf4jVersion")

implementation("io.lettuce:lettuce-core:$lettuceVersion")

testFixturesApi("com.github.navikt:rapids-and-rivers:$rapidsAndRiversVersion")
testFixturesApi("io.lettuce:lettuce-core:$lettuceVersion")

testFixturesImplementation("io.kotest:kotest-assertions-core:$kotestVersion")
testFixturesImplementation("io.kotest:kotest-runner-junit5:$kotestVersion")
testFixturesImplementation("io.mockk:mockk:$mockkVersion")
testFixturesImplementation(testFixtures("no.nav.helsearbeidsgiver:utils:$utilsVersion"))
}
7 changes: 4 additions & 3 deletions integrasjonstest/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ dependencies {
testImplementation(project(":brreg"))
testImplementation(project(":db"))
testImplementation(project(":distribusjon"))
testImplementation(project(":felles"))
testImplementation(project(":felles-db-exposed"))
testImplementation(project(":felles-test"))
testImplementation(project(":forespoersel-besvart"))
testImplementation(project(":forespoersel-marker-besvart"))
testImplementation(project(":forespoersel-mottatt"))
Expand All @@ -35,6 +32,10 @@ dependencies {
testImplementation(project(":tilgangservice"))
testImplementation(project(":trengerservice"))

testImplementation(project(":felles"))
testImplementation(project(":felles-db-exposed"))

testImplementation(testFixtures(project(":felles")))
testImplementation(testFixtures(project(":felles-db-exposed")))

// Klienter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import io.kotest.assertions.throwables.shouldThrowExactly
import io.kotest.matchers.collections.shouldHaveSize
import io.kotest.matchers.ints.shouldBeExactly
import io.kotest.matchers.shouldBe
import no.nav.helsearbeidsgiver.felles.db.test.exposed.FunSpecWithDb
import no.nav.helsearbeidsgiver.felles.db.exposed.test.FunSpecWithDb
import no.nav.helsearbeidsgiver.inntektsmelding.notifikasjon.sakLevetid
import org.jetbrains.exposed.exceptions.ExposedSQLException
import org.jetbrains.exposed.sql.Database
Expand Down

0 comments on commit 0ca08ec

Please sign in to comment.