summaryrefslogtreecommitdiff
path: root/src/test/kotlin/dev/dnpm
diff options
context:
space:
mode:
authorPaul-Christian Volkmer2023-08-12 22:19:29 +0200
committerPaul-Christian Volkmer2023-08-12 22:19:29 +0200
commit72295202ec37a76b90a919e39ae094bb7e56d202 (patch)
tree5d3ec1517e79a98a74da2664d2c5a00f05fabc23 /src/test/kotlin/dev/dnpm
parentbc48a7217eb98e9ec95e5c8b0908b2a1d8a6b27c (diff)
Code cleanup
Diffstat (limited to 'src/test/kotlin/dev/dnpm')
-rw-r--r--src/test/kotlin/dev/dnpm/etl/processor/output/RestMtbFileSenderTest.kt16
-rw-r--r--src/test/kotlin/dev/dnpm/etl/processor/services/ResponseProcessorTest.kt6
-rw-r--r--src/test/kotlin/dev/dnpm/etl/processor/services/kafka/KafkaResponseProcessorTest.kt8
3 files changed, 13 insertions, 17 deletions
diff --git a/src/test/kotlin/dev/dnpm/etl/processor/output/RestMtbFileSenderTest.kt b/src/test/kotlin/dev/dnpm/etl/processor/output/RestMtbFileSenderTest.kt
index 78b5a45..0cad285 100644
--- a/src/test/kotlin/dev/dnpm/etl/processor/output/RestMtbFileSenderTest.kt
+++ b/src/test/kotlin/dev/dnpm/etl/processor/output/RestMtbFileSenderTest.kt
@@ -105,7 +105,7 @@ class RestMtbFileSenderTest {
}
""".trimIndent()
- val mtbFile = MtbFile.builder()
+ val mtbFile: MtbFile = MtbFile.builder()
.withPatient(
Patient.builder()
.withId("PID")
@@ -129,7 +129,7 @@ class RestMtbFileSenderTest {
)
.build()
- private val errorResponseBody = "Sonstiger Fehler bei der Übertragung"
+ private const val ERROR_RESPONSE_BODY = "Sonstiger Fehler bei der Übertragung"
/**
* Synthetic http responses with related request status
@@ -147,23 +147,23 @@ class RestMtbFileSenderTest {
RequestWithResponse(
HttpStatus.BAD_REQUEST,
"??",
- MtbFileSender.Response(RequestStatus.ERROR, errorResponseBody)
+ MtbFileSender.Response(RequestStatus.ERROR, ERROR_RESPONSE_BODY)
),
RequestWithResponse(
HttpStatus.UNPROCESSABLE_ENTITY,
errorBody,
- MtbFileSender.Response(RequestStatus.ERROR, errorResponseBody)
+ MtbFileSender.Response(RequestStatus.ERROR, ERROR_RESPONSE_BODY)
),
// Some more errors not mentioned in documentation
RequestWithResponse(
HttpStatus.NOT_FOUND,
"what????",
- MtbFileSender.Response(RequestStatus.ERROR, errorResponseBody)
+ MtbFileSender.Response(RequestStatus.ERROR, ERROR_RESPONSE_BODY)
),
RequestWithResponse(
HttpStatus.INTERNAL_SERVER_ERROR,
"what????",
- MtbFileSender.Response(RequestStatus.ERROR, errorResponseBody)
+ MtbFileSender.Response(RequestStatus.ERROR, ERROR_RESPONSE_BODY)
)
)
}
@@ -180,12 +180,12 @@ class RestMtbFileSenderTest {
RequestWithResponse(
HttpStatus.NOT_FOUND,
"what????",
- MtbFileSender.Response(RequestStatus.ERROR, errorResponseBody)
+ MtbFileSender.Response(RequestStatus.ERROR, ERROR_RESPONSE_BODY)
),
RequestWithResponse(
HttpStatus.INTERNAL_SERVER_ERROR,
"what????",
- MtbFileSender.Response(RequestStatus.ERROR, errorResponseBody)
+ MtbFileSender.Response(RequestStatus.ERROR, ERROR_RESPONSE_BODY)
)
)
}
diff --git a/src/test/kotlin/dev/dnpm/etl/processor/services/ResponseProcessorTest.kt b/src/test/kotlin/dev/dnpm/etl/processor/services/ResponseProcessorTest.kt
index cfb1111..b9e4b7f 100644
--- a/src/test/kotlin/dev/dnpm/etl/processor/services/ResponseProcessorTest.kt
+++ b/src/test/kotlin/dev/dnpm/etl/processor/services/ResponseProcessorTest.kt
@@ -19,8 +19,6 @@
package dev.dnpm.etl.processor.services
-import com.fasterxml.jackson.databind.ObjectMapper
-import com.fasterxml.jackson.module.kotlin.KotlinModule
import dev.dnpm.etl.processor.monitoring.Request
import dev.dnpm.etl.processor.monitoring.RequestRepository
import dev.dnpm.etl.processor.monitoring.RequestStatus
@@ -62,12 +60,10 @@ class ResponseProcessorTest {
@Mock requestRepository: RequestRepository,
@Mock statisticsUpdateProducer: Sinks.Many<Any>
) {
- val objectMapper = ObjectMapper().registerModule(KotlinModule.Builder().build())
-
this.requestRepository = requestRepository
this.statisticsUpdateProducer = statisticsUpdateProducer
- this.responseProcessor = ResponseProcessor(requestRepository, statisticsUpdateProducer, objectMapper)
+ this.responseProcessor = ResponseProcessor(requestRepository, statisticsUpdateProducer)
}
@Test
diff --git a/src/test/kotlin/dev/dnpm/etl/processor/services/kafka/KafkaResponseProcessorTest.kt b/src/test/kotlin/dev/dnpm/etl/processor/services/kafka/KafkaResponseProcessorTest.kt
index 0f524ca..6d83146 100644
--- a/src/test/kotlin/dev/dnpm/etl/processor/services/kafka/KafkaResponseProcessorTest.kt
+++ b/src/test/kotlin/dev/dnpm/etl/processor/services/kafka/KafkaResponseProcessorTest.kt
@@ -45,7 +45,7 @@ class KafkaResponseProcessorTest {
private lateinit var kafkaResponseProcessor: KafkaResponseProcessor
- private fun createkafkaRecord(
+ private fun createKafkaRecord(
requestId: String? = null,
statusCode: Int = 200,
statusBody: Map<String, Any>? = mapOf()
@@ -79,14 +79,14 @@ class KafkaResponseProcessorTest {
@Test
fun shouldNotProcessRecordsWithoutValidKey() {
- this.kafkaResponseProcessor.onMessage(createkafkaRecord(null, 200))
+ this.kafkaResponseProcessor.onMessage(createKafkaRecord(null, 200))
verify(eventPublisher, never()).publishEvent(any())
}
@Test
fun shouldNotProcessRecordsWithoutValidBody() {
- this.kafkaResponseProcessor.onMessage(createkafkaRecord(requestId = "TestID1234", statusBody = null))
+ this.kafkaResponseProcessor.onMessage(createKafkaRecord(requestId = "TestID1234", statusBody = null))
verify(eventPublisher, never()).publishEvent(any())
}
@@ -94,7 +94,7 @@ class KafkaResponseProcessorTest {
@ParameterizedTest
@MethodSource("statusCodeSource")
fun shouldProcessValidRecordsWithStatusCode(statusCode: Int) {
- this.kafkaResponseProcessor.onMessage(createkafkaRecord("TestID1234", statusCode))
+ this.kafkaResponseProcessor.onMessage(createKafkaRecord("TestID1234", statusCode))
verify(eventPublisher, times(1)).publishEvent(any<ResponseEvent>())
}