Skip to content

Commit

Permalink
records test
Browse files Browse the repository at this point in the history
  • Loading branch information
h1alexbel committed May 8, 2023
1 parent 7322e82 commit 19674b2
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/test/java/io/github/eocqrs/kafka/consumer/KfConsumerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import io.github.eocqrs.kafka.parameters.ValueDeserializer;
import io.github.eocqrs.kafka.xml.KfXmlFlexible;

import java.time.Duration;
import java.util.Collection;

import org.apache.kafka.clients.consumer.ConsumerRebalanceListener;
Expand Down Expand Up @@ -83,6 +84,21 @@ public void onPartitionsAssigned(final Collection<TopicPartition> partitions) {
);
}

@Test
void recordsPollingDoesntThrowException(
@Mock final ConsumerSettings<String, String> settings,
@Mock final KafkaConsumer<String, String> origin
) {
Mockito.when(settings.consumer()).thenReturn(origin);
final Consumer<String, String> consumer =
new KfConsumer<>(settings);
assertDoesNotThrow(() ->
consumer.records(
"TEST", Duration.ofSeconds(5L)
)
);
}

@Test
void unsubscribesWithoutException(
@Mock final ConsumerSettings<String, String> settings,
Expand Down

0 comments on commit 19674b2

Please sign in to comment.