Skip to content

Commit

Permalink
fix: tests should support kafka message key
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffreiffers committed Nov 25, 2024
1 parent 293b16c commit 94e544d
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class KafkaDatasetEventConsumerTest {
timestamp
)
every { dcatComplianceService.validateDcatCompliance(any()) } returns validDcatMQAEvent
every { kafkaTemplate.send(any(), any()) } returns CompletableFuture()
every { kafkaTemplate.send(any(), any(), any()) } returns CompletableFuture()
every { ack.acknowledge() } returns Unit
every { ack.nack(Duration.ZERO) } returns Unit

Expand All @@ -53,6 +53,8 @@ class KafkaDatasetEventConsumerTest {
verify {
kafkaTemplate.send(withArg {
assertEquals("mqa-events", it)
}, withArg {
assertEquals(datasetEvent.fdkId, it)
}, withArg {
assertEquals(datasetEvent.fdkId, it.fdkId)
assertEquals(MQAEventType.DCAT_COMPLIANCE_CHECKED, it.type)
Expand All @@ -75,7 +77,7 @@ class KafkaDatasetEventConsumerTest {
)

every { dcatComplianceService.validateDcatCompliance(any()) } returns invalidDcatMQAEvent
every { kafkaTemplate.send(any(), any()) } returns CompletableFuture()
every { kafkaTemplate.send(any(), any(), any()) } returns CompletableFuture()
every { ack.acknowledge() } returns Unit
every { ack.nack(Duration.ZERO) } returns Unit

Expand All @@ -88,6 +90,8 @@ class KafkaDatasetEventConsumerTest {
verify {
kafkaTemplate.send(withArg {
assertEquals("mqa-events", it)
}, withArg {
assertEquals(datasetEvent.fdkId, it)
}, withArg {
assertEquals(datasetEvent.fdkId, it.fdkId)
assertEquals(MQAEventType.DCAT_COMPLIANCE_CHECKED, it.type)
Expand All @@ -110,7 +114,7 @@ class KafkaDatasetEventConsumerTest {
ack = ack
)

verify(exactly = 0) { kafkaTemplate.send(any(), any()) }
verify(exactly = 0) { kafkaTemplate.send(any(), any(), any()) }
verify(exactly = 1) { ack.nack(Duration.ZERO) }
verify(exactly = 0) { ack.acknowledge() }
confirmVerified(kafkaTemplate, ack)
Expand Down

0 comments on commit 94e544d

Please sign in to comment.