Skip to content

Commit 9510d44

Browse files
committed
Add missed import for Optional
1 parent e1c59c5 commit 9510d44

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

spring-kafka/src/test/java/org/springframework/kafka/listener/ManualNackRecordTests.java

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import java.util.LinkedHashMap;
3434
import java.util.List;
3535
import java.util.Map;
36+
import java.util.Optional;
3637
import java.util.concurrent.CountDownLatch;
3738
import java.util.concurrent.TimeUnit;
3839
import java.util.concurrent.atomic.AtomicInteger;
@@ -58,7 +59,6 @@
5859
import org.springframework.kafka.listener.ContainerProperties.AckMode;
5960
import org.springframework.kafka.support.Acknowledgment;
6061
import org.springframework.kafka.test.utils.KafkaTestUtils;
61-
import org.springframework.lang.Nullable;
6262
import org.springframework.test.annotation.DirtiesContext;
6363
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
6464

@@ -74,6 +74,7 @@ public class ManualNackRecordTests {
7474
@SuppressWarnings("rawtypes")
7575
@Autowired
7676
private Consumer consumer;
77+
7778
@Autowired
7879
private Config config;
7980

@@ -146,7 +147,7 @@ public ConsumerFactory consumerFactory() {
146147
ConsumerFactory consumerFactory = mock(ConsumerFactory.class);
147148
final Consumer consumer = consumer();
148149
given(consumerFactory.createConsumer("grp", "", "-0", KafkaTestUtils.defaultPropertyOverrides()))
149-
.willReturn(consumer);
150+
.willReturn(consumer);
150151
return consumerFactory;
151152
}
152153

@@ -213,17 +214,11 @@ public ConcurrentKafkaListenerContainerFactory kafkaListenerContainerFactory() {
213214
factory.setErrorHandler(new SeekToCurrentErrorHandler());
214215
factory.getContainerProperties().setAckMode(AckMode.MANUAL);
215216
factory.getContainerProperties().setMissingTopicsFatal(false);
216-
factory.setRecordInterceptor(new RecordInterceptor() {
217-
218-
@Override
219-
@Nullable
220-
public ConsumerRecord intercept(ConsumerRecord record) {
221-
return new ConsumerRecord(record.topic(), record.partition(), record.offset(), 0L,
217+
factory.setRecordInterceptor(record ->
218+
new ConsumerRecord(record.topic(), record.partition(), record.offset(), 0L,
222219
TimestampType.NO_TIMESTAMP_TYPE, 0, 0, record.key(), record.value(), record.headers(),
223-
Optional.empty());
224-
}
225-
226-
});
220+
Optional.empty())
221+
);
227222
return factory;
228223
}
229224

0 commit comments

Comments
 (0)