Skip to content

Commit

Permalink
Minor code cleanup in BatchToRecordAdapter tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sobychacko committed Jul 1, 2024
1 parent 12e0301 commit 96939da
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2019 the original author or authors.
* Copyright 2019-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -38,6 +38,7 @@

/**
* @author Gary Russell
* @author Soby Chacko
* @since 2.2.5
*
*/
Expand All @@ -52,8 +53,8 @@ void test(@Autowired KafkaListenerEndpointRegistry registry, @Autowired TestList
(BatchMessagingMessageListenerAdapter<String, String>) registry
.getListenerContainer("batchRecordAdapter").getContainerProperties().getMessageListener();
List<ConsumerRecord<String, String>> records = new ArrayList<>();
records.add(new ConsumerRecord<String, String>("foo", 0, 0, null, "foo"));
ConsumerRecord<String, String> barRecord = new ConsumerRecord<String, String>("foo", 0, 1, null, "bar");
records.add(new ConsumerRecord<>("foo", 0, 0, null, "foo"));
ConsumerRecord<String, String> barRecord = new ConsumerRecord<>("foo", 0, 1, null, "bar");
records.add(barRecord);
records.add(new ConsumerRecord<String, String>("foo", 0, 2, null, "baz"));
adapter.onMessage(records, null, null);
Expand All @@ -71,10 +72,10 @@ void testFullRecord(@Autowired KafkaListenerEndpointRegistry registry, @Autowire
(BatchMessagingMessageListenerAdapter<String, String>) registry
.getListenerContainer("batchRecordAdapterFullRecord").getContainerProperties().getMessageListener();
List<ConsumerRecord<String, String>> records = new ArrayList<>();
records.add(new ConsumerRecord<String, String>("foo", 0, 0, null, "foo"));
records.add(new ConsumerRecord<>("foo", 0, 0, null, "foo"));
ConsumerRecord<String, String> barRecord = new ConsumerRecord<String, String>("foo", 0, 1, null, "bar");
records.add(barRecord);
records.add(new ConsumerRecord<String, String>("foo", 0, 2, null, "baz"));
records.add(new ConsumerRecord<>("foo", 0, 2, null, "baz"));
adapter.onMessage(records, null, null);
assertThat(foo.values2).contains("foo", "bar", "baz");
assertThat(config.failed).isNull();
Expand Down

0 comments on commit 96939da

Please sign in to comment.