Skip to content

Instantly share code, notes, and snippets.

View qyf404's full-sized avatar

QiYifei qyf404

View GitHub Profile
@qyf404
qyf404 / KafkaProducerTest.java
Created January 21, 2020 12:17 — forked from itzg/KafkaProducerTest.java
Using embedded Kafka in Spring Boot unit test
import static org.junit.Assert.assertThat;
import static org.springframework.kafka.test.hamcrest.KafkaMatchers.hasKey;
import static org.springframework.kafka.test.hamcrest.KafkaMatchers.hasValue;
import static org.springframework.kafka.test.utils.KafkaTestUtils.getSingleRecord;
import java.util.Map;
import org.apache.kafka.clients.consumer.Consumer;
import org.apache.kafka.clients.consumer.ConsumerConfig;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.apache.kafka.common.serialization.Deserializer;
@qyf404
qyf404 / KafkaProducerTest.java
Created January 21, 2020 12:17 — forked from itzg/KafkaProducerTest.java
Using embedded Kafka in Spring Boot unit test
import static org.junit.Assert.assertThat;
import static org.springframework.kafka.test.hamcrest.KafkaMatchers.hasKey;
import static org.springframework.kafka.test.hamcrest.KafkaMatchers.hasValue;
import static org.springframework.kafka.test.utils.KafkaTestUtils.getSingleRecord;
import java.util.Map;
import org.apache.kafka.clients.consumer.Consumer;
import org.apache.kafka.clients.consumer.ConsumerConfig;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.apache.kafka.common.serialization.Deserializer;