Skip to content

Commit c96a904

Browse files
committed
Merge branch 'feat/queue-instrumentation-spring-boot-4' into feat/queue-instrumentation-spring-boot-2
2 parents 85019fe + 557686a commit c96a904

4 files changed

Lines changed: 6 additions & 34 deletions

File tree

sentry-spring-7/src/test/kotlin/io/sentry/spring7/kafka/SentryKafkaConsumerBeanPostProcessorTest.kt

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ package io.sentry.spring7.kafka
33
import kotlin.test.Test
44
import kotlin.test.assertSame
55
import kotlin.test.assertTrue
6-
import org.apache.kafka.clients.consumer.Consumer
7-
import org.apache.kafka.clients.consumer.ConsumerRecord
86
import org.mockito.kotlin.mock
97
import org.springframework.kafka.config.ConcurrentKafkaListenerContainerFactory
108
import org.springframework.kafka.core.ConsumerFactory
@@ -65,13 +63,7 @@ class SentryKafkaConsumerBeanPostProcessorTest {
6563
val factory = ConcurrentKafkaListenerContainerFactory<String, String>()
6664
factory.setConsumerFactory(consumerFactory)
6765

68-
val customerInterceptor =
69-
object : RecordInterceptor<String, String> {
70-
override fun intercept(
71-
record: ConsumerRecord<String, String>,
72-
consumer: Consumer<String, String>,
73-
): ConsumerRecord<String, String>? = record
74-
}
66+
val customerInterceptor = RecordInterceptor<String, String> { record, _ -> record }
7567
factory.setRecordInterceptor(customerInterceptor)
7668

7769
val processor = SentryKafkaConsumerBeanPostProcessor()
@@ -99,13 +91,7 @@ class SentryKafkaConsumerBeanPostProcessorTest {
9991
val consumerFactory = mock<ConsumerFactory<String, String>>()
10092
val factory = ConcurrentKafkaListenerContainerFactory<String, String>()
10193
factory.setConsumerFactory(consumerFactory)
102-
val customerInterceptor =
103-
object : RecordInterceptor<String, String> {
104-
override fun intercept(
105-
record: ConsumerRecord<String, String>,
106-
consumer: Consumer<String, String>,
107-
): ConsumerRecord<String, String>? = record
108-
}
94+
val customerInterceptor = RecordInterceptor<String, String> { record, _ -> record }
10995
factory.setRecordInterceptor(customerInterceptor)
11096

11197
val field = factory.javaClass.superclass.getDeclaredField("recordInterceptor")

sentry-spring-7/src/test/kotlin/io/sentry/spring7/kafka/SentryKafkaRecordInterceptorTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ class SentryKafkaRecordInterceptorTest {
122122
ByteBuffer.allocate(Int.SIZE_BYTES).putInt(it).array(),
123123
)
124124
}
125-
val record = ConsumerRecord<String, String>("my-topic", 0, 0L, "key", "value")
125+
val record = ConsumerRecord("my-topic", 0, 0L, "key", "value")
126126
headers.forEach { record.headers().add(it) }
127127
return record
128128
}

sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/kafka/SentryKafkaConsumerBeanPostProcessorTest.kt

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ package io.sentry.spring.jakarta.kafka
33
import kotlin.test.Test
44
import kotlin.test.assertSame
55
import kotlin.test.assertTrue
6-
import org.apache.kafka.clients.consumer.Consumer
7-
import org.apache.kafka.clients.consumer.ConsumerRecord
86
import org.mockito.kotlin.mock
97
import org.springframework.kafka.config.ConcurrentKafkaListenerContainerFactory
108
import org.springframework.kafka.core.ConsumerFactory
@@ -65,13 +63,7 @@ class SentryKafkaConsumerBeanPostProcessorTest {
6563
val factory = ConcurrentKafkaListenerContainerFactory<String, String>()
6664
factory.consumerFactory = consumerFactory
6765

68-
val customerInterceptor =
69-
object : RecordInterceptor<String, String> {
70-
override fun intercept(
71-
record: ConsumerRecord<String, String>,
72-
consumer: Consumer<String, String>,
73-
): ConsumerRecord<String, String>? = record
74-
}
66+
val customerInterceptor = RecordInterceptor<String, String> { record, _ -> record }
7567
factory.setRecordInterceptor(customerInterceptor)
7668

7769
val processor = SentryKafkaConsumerBeanPostProcessor()
@@ -99,13 +91,7 @@ class SentryKafkaConsumerBeanPostProcessorTest {
9991
val consumerFactory = mock<ConsumerFactory<String, String>>()
10092
val factory = ConcurrentKafkaListenerContainerFactory<String, String>()
10193
factory.consumerFactory = consumerFactory
102-
val customerInterceptor =
103-
object : RecordInterceptor<String, String> {
104-
override fun intercept(
105-
record: ConsumerRecord<String, String>,
106-
consumer: Consumer<String, String>,
107-
): ConsumerRecord<String, String>? = record
108-
}
94+
val customerInterceptor = RecordInterceptor<String, String> { record, _ -> record }
10995
factory.setRecordInterceptor(customerInterceptor)
11096

11197
val field = factory.javaClass.superclass.getDeclaredField("recordInterceptor")

sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/kafka/SentryKafkaRecordInterceptorTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ class SentryKafkaRecordInterceptorTest {
122122
ByteBuffer.allocate(Int.SIZE_BYTES).putInt(it).array(),
123123
)
124124
}
125-
val record = ConsumerRecord<String, String>("my-topic", 0, 0L, "key", "value")
125+
val record = ConsumerRecord("my-topic", 0, 0L, "key", "value")
126126
headers.forEach { record.headers().add(it) }
127127
return record
128128
}

0 commit comments

Comments
 (0)