diff options
Diffstat (limited to 'src/test/kotlin/dev/dnpm')
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>()) } |
