diff options
Diffstat (limited to 'src/test')
4 files changed, 21 insertions, 9 deletions
diff --git a/src/test/java/dev/dnpm/etl/processor/consent/GicsConsentServiceTest.java b/src/test/java/dev/dnpm/etl/processor/consent/GicsConsentServiceTest.java index e450e4d..22f676b 100644 --- a/src/test/java/dev/dnpm/etl/processor/consent/GicsConsentServiceTest.java +++ b/src/test/java/dev/dnpm/etl/processor/consent/GicsConsentServiceTest.java @@ -26,7 +26,7 @@ import org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.client.RestClientTest; +import org.springframework.boot.restclient.test.autoconfigure.RestClientTest; import org.springframework.http.MediaType; import org.springframework.retry.support.RetryTemplate; import org.springframework.test.context.ContextConfiguration; diff --git a/src/test/java/dev/dnpm/etl/processor/consent/GicsGetBroadConsentServiceTest.java b/src/test/java/dev/dnpm/etl/processor/consent/GicsGetBroadConsentServiceTest.java index cced1cf..46da158 100644 --- a/src/test/java/dev/dnpm/etl/processor/consent/GicsGetBroadConsentServiceTest.java +++ b/src/test/java/dev/dnpm/etl/processor/consent/GicsGetBroadConsentServiceTest.java @@ -21,7 +21,7 @@ import org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.client.RestClientTest; +import org.springframework.boot.restclient.test.autoconfigure.RestClientTest; import org.springframework.http.MediaType; import org.springframework.retry.support.RetryTemplate; import org.springframework.test.context.ContextConfiguration; diff --git a/src/test/kotlin/dev/dnpm/etl/processor/helpers.kt b/src/test/kotlin/dev/dnpm/etl/processor/helpers.kt index 495bf38..b7bf436 100644 --- a/src/test/kotlin/dev/dnpm/etl/processor/helpers.kt +++ b/src/test/kotlin/dev/dnpm/etl/processor/helpers.kt @@ -25,6 +25,6 @@ import org.junit.jupiter.params.provider.Arguments import org.junit.jupiter.params.provider.ArgumentsProvider open class ArgProvider(vararg val data: Arguments) : ArgumentsProvider { - override fun provideArguments(context: ExtensionContext?): Stream<out Arguments> = + override fun provideArguments(context: ExtensionContext): Stream<out Arguments> = Stream.of(*data) } diff --git a/src/test/kotlin/dev/dnpm/etl/processor/output/KafkaMtbFileSenderTest.kt b/src/test/kotlin/dev/dnpm/etl/processor/output/KafkaMtbFileSenderTest.kt index 8adc21c..ac14366 100644 --- a/src/test/kotlin/dev/dnpm/etl/processor/output/KafkaMtbFileSenderTest.kt +++ b/src/test/kotlin/dev/dnpm/etl/processor/output/KafkaMtbFileSenderTest.kt @@ -31,6 +31,8 @@ import java.util.* import java.util.concurrent.CompletableFuture.completedFuture import java.util.concurrent.ExecutionException import org.apache.kafka.clients.producer.ProducerRecord +import org.apache.kafka.clients.producer.RecordMetadata +import org.apache.kafka.common.TopicPartition import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Nested @@ -77,7 +79,7 @@ class KafkaMtbFileSenderTest { if (null != testData.exception) { throw testData.exception } - completedFuture(SendResult<String, String>(null, null)) + completedFuture(SendResult<String, String>(testProducerRecord(), testProducerRecordWithMetadata())) } .whenever(kafkaTemplate) .send(any<ProducerRecord<String, String>>()) @@ -98,7 +100,7 @@ class KafkaMtbFileSenderTest { if (null != testData.exception) { throw testData.exception } - completedFuture(SendResult<String, String>(null, null)) + completedFuture(SendResult<String, String>(testProducerRecord(), testProducerRecordWithMetadata())) } .whenever(kafkaTemplate) .send(any<ProducerRecord<String, String>>()) @@ -145,7 +147,7 @@ class KafkaMtbFileSenderTest { if (null != testData.exception) { throw testData.exception } - completedFuture(SendResult<String, String>(null, null)) + completedFuture(SendResult<String, String>(testProducerRecord(), testProducerRecordWithMetadata())) } .whenever(kafkaTemplate) .send(any<ProducerRecord<String, String>>()) @@ -156,7 +158,7 @@ class KafkaMtbFileSenderTest { @Test fun shouldSendMtbFileRequestWithCorrectKeyAndHeaderAndBody() { - doAnswer { completedFuture(SendResult<String, String>(null, null)) } + doAnswer { completedFuture(SendResult<String, String>(testProducerRecord(), testProducerRecordWithMetadata())) } .whenever(kafkaTemplate) .send(any<ProducerRecord<String, String>>()) @@ -182,7 +184,7 @@ class KafkaMtbFileSenderTest { @Test fun shouldSendDeleteRequestWithCorrectKeyAndHeaderAndBody() { - doAnswer { completedFuture(SendResult<String, String>(null, null)) } + doAnswer { completedFuture(SendResult<String, String>(testProducerRecord(), testProducerRecordWithMetadata())) } .whenever(kafkaTemplate) .send(any<ProducerRecord<String, String>>()) @@ -216,7 +218,7 @@ class KafkaMtbFileSenderTest { if (null != testData.exception) { throw testData.exception } - completedFuture(SendResult<String, String>(null, null)) + completedFuture(SendResult<String, String>(testProducerRecord(), testProducerRecordWithMetadata())) } .whenever(kafkaTemplate) .send(any<ProducerRecord<String, String>>()) @@ -235,6 +237,16 @@ class KafkaMtbFileSenderTest { } } + fun testProducerRecord(): ProducerRecord<String, String> { + return ProducerRecord<String, String>("testtopic", "testkey", "testvalue") + } + + fun testProducerRecordWithMetadata(): RecordMetadata { + return RecordMetadata( + TopicPartition("testtopic", 0), 0, 0, Instant.now().epochSecond, 0, 0 + ) + } + companion object { val TEST_REQUEST_ID = RequestId("TestId") val TEST_PATIENT_PSEUDONYM = PatientPseudonym("PID") |
