Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Martishin authored and Alex Martishin committed Nov 24, 2023
1 parent 446272e commit 55f63b6
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 3 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ val flywayVersion = "8.5.11"
val jooqVersion = "3.18.4"
val mockkVersion = "1.13.5"
val springmockkVersion = "4.0.2"
val testcontainersVersion = "1.18.0"
val testcontainersVersion = "1.19.3"

repositories {
mavenCentral()
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ management:
endpoints:
web:
exposure:
include: health,info,prometheus
include: '*'
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class IntegrationTests(

@AfterEach
fun cleanup() {
databaseClient.sql("TRUNCATE TABLE companies")
databaseClient.sql("TRUNCATE TABLE companies;")
.then()
.subscribe()
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.ttymonkey.springcoroutines.config

import io.micrometer.core.instrument.MeterRegistry
import io.micrometer.core.instrument.simple.SimpleMeterRegistry
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration

@Configuration
class TestConfig {
@Bean
fun meterRegistry(): MeterRegistry {
return SimpleMeterRegistry()
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.ttymonkey.springcoroutines.controllers

import com.ninjasquad.springmockk.MockkBean
import com.ttymonkey.springcoroutines.config.TestConfig
import com.ttymonkey.springcoroutines.models.Company
import com.ttymonkey.springcoroutines.services.CompanyService
import com.ttymonkey.springcoroutines.services.UserService
Expand All @@ -11,10 +12,12 @@ import org.junit.jupiter.api.Test
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.test.autoconfigure.web.reactive.WebFluxTest
import org.springframework.test.web.reactive.server.WebTestClient
import org.springframework.context.annotation.Import
import java.util.UUID
import kotlin.random.Random

@WebFluxTest
@Import(TestConfig::class)
class CompanyControllerTest(@Autowired val webClient: WebTestClient) {
@MockkBean
private lateinit var companyService: CompanyService
Expand Down

0 comments on commit 55f63b6

Please sign in to comment.