Skip to content

Commit 2cecae1

Browse files
committed
Incorporate Review comments
1 parent b24851b commit 2cecae1

4 files changed

Lines changed: 11 additions & 16 deletions

File tree

apache-kafka-2/src/main/java/com/baeldung/kafka/message/ordering/Config.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ public class Config {
77

88
public static final int MULTIPLE_PARTITIONS = 5;
99
public static final int SINGLE_PARTITION = 1;
10-
public static short REPLICATION_FACTOR = 1;
10+
public static final short REPLICATION_FACTOR = 1;
1111
}

apache-kafka-2/src/test/java/com/baeldung/kafka/message/ordering/ExtSeqWithTimeWindowIntegrationTest.java renamed to apache-kafka-2/src/test/java/com/baeldung/kafka/message/ordering/ExternalSequenceWithTimeWindowIntegrationTest.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import org.apache.kafka.clients.producer.ProducerConfig;
1212
import org.apache.kafka.clients.producer.ProducerRecord;
1313
import org.apache.kafka.clients.producer.RecordMetadata;
14-
import org.apache.kafka.common.KafkaFuture;
1514
import org.apache.kafka.common.serialization.LongDeserializer;
1615
import org.apache.kafka.common.serialization.LongSerializer;
1716
import org.junit.jupiter.api.AfterAll;
@@ -25,8 +24,8 @@
2524
import java.util.*;
2625
import java.util.concurrent.ExecutionException;
2726
import java.util.concurrent.Future;
28-
29-
import static org.junit.jupiter.api.Assertions.*;
27+
import com.google.common.collect.ImmutableList;
28+
import static org.assertj.core.api.AssertionsForInterfaceTypes.assertThat;
3029

3130
@Testcontainers
3231
public class ExternalSequenceWithTimeWindowIntegrationTest {
@@ -84,7 +83,6 @@ void givenMultiplePartitions_whenPublishedToKafkaAndConsumedWithExtSeqNumberAndT
8483
System.out.println("User Event ID: " + userEvent.getUserEventId() + ", Partition : " + metadata.partition());
8584
}
8685

87-
boolean isOrderMaintained = true;
8886
consumer.subscribe(Collections.singletonList(Config.MULTI_PARTITION_TOPIC));
8987
List<UserEvent> buffer = new ArrayList<>();
9088
long lastProcessedTime = System.nanoTime();
@@ -102,9 +100,9 @@ void givenMultiplePartitions_whenPublishedToKafkaAndConsumedWithExtSeqNumberAndT
102100
buffer.add(record.value());
103101
});
104102
}
105-
assertThat(receivedUserEventList)
106-
.isEqualTo(sentUserEventList)
107-
.containsExactlyElementsOf(sentUserEventList);
103+
assertThat(receivedUserEventList)
104+
.isEqualTo(sentUserEventList)
105+
.containsExactlyElementsOf(sentUserEventList);
108106
}
109107

110108
private static void processBuffer(List<UserEvent> buffer, List<UserEvent> receivedUserEventList) {

apache-kafka-2/src/test/java/com/baeldung/kafka/message/ordering/MultiplePartitionIntegrationTest.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import org.apache.kafka.clients.producer.ProducerConfig;
1212
import org.apache.kafka.clients.producer.ProducerRecord;
1313
import org.apache.kafka.clients.producer.RecordMetadata;
14-
import org.apache.kafka.common.KafkaFuture;
1514
import org.apache.kafka.common.serialization.LongDeserializer;
1615
import org.apache.kafka.common.serialization.LongSerializer;
1716
import org.junit.jupiter.api.AfterAll;
@@ -25,8 +24,8 @@
2524
import java.util.*;
2625
import java.util.concurrent.ExecutionException;
2726
import java.util.concurrent.Future;
28-
29-
import static org.junit.jupiter.api.Assertions.*;
27+
import com.google.common.collect.ImmutableList;
28+
import static org.assertj.core.api.AssertionsForInterfaceTypes.assertThat;
3029

3130
@Testcontainers
3231
public class MultiplePartitionIntegrationTest {
@@ -89,7 +88,7 @@ void givenMultiplePartitions_whenPublishedToKafkaAndConsumed_thenCheckForMessage
8988
receivedUserEventList.add(userEvent);
9089
System.out.println("User Event ID: " + userEvent.getUserEventId());
9190
});
92-
assertThat(receivedUserEventList)
91+
assertThat(receivedUserEventList)
9392
.isNotEqualTo(sentUserEventList)
9493
.containsExactlyInAnyOrderElementsOf(sentUserEventList);
9594
}

apache-kafka-2/src/test/java/com/baeldung/kafka/message/ordering/SinglePartitionIntegrationTest.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import com.baeldung.kafka.message.ordering.serialization.JacksonSerializer;
66
import org.apache.kafka.clients.admin.Admin;
77
import org.apache.kafka.clients.admin.AdminClientConfig;
8-
import org.apache.kafka.clients.admin.CreateTopicsResult;
98
import org.apache.kafka.clients.admin.NewTopic;
109
import org.apache.kafka.clients.consumer.ConsumerConfig;
1110
import org.apache.kafka.clients.consumer.ConsumerRecords;
@@ -14,7 +13,6 @@
1413
import org.apache.kafka.clients.producer.ProducerConfig;
1514
import org.apache.kafka.clients.producer.ProducerRecord;
1615
import org.apache.kafka.clients.producer.RecordMetadata;
17-
import org.apache.kafka.common.KafkaFuture;
1816
import org.apache.kafka.common.serialization.LongDeserializer;
1917
import org.apache.kafka.common.serialization.LongSerializer;
2018
import org.junit.jupiter.api.AfterAll;
@@ -29,8 +27,8 @@
2927
import java.util.*;
3028
import java.util.concurrent.ExecutionException;
3129
import java.util.concurrent.Future;
32-
33-
import static org.junit.jupiter.api.Assertions.assertTrue;
30+
import com.google.common.collect.ImmutableList;
31+
import static org.assertj.core.api.AssertionsForInterfaceTypes.assertThat;
3432

3533
@Testcontainers
3634
public class SinglePartitionIntegrationTest {

0 commit comments

Comments
 (0)