Files
Gary Russell 44dfb314c1 GH-210: Upgrade test-embedded-kafka to JUnit5 (#211)
* GH-210: Upgrade test-embedded-kafka to JUnit5

Resolves https://github.com/spring-cloud/spring-cloud-stream-samples/issues/210

* Avoid a rebalance by using a different group in the test; use `assign()` instead of `subscribe()`.
2021-08-26 15:29:13 -04:00
..
2018-03-09 10:47:22 -05:00
2018-03-09 10:47:22 -05:00
2019-03-21 15:21:19 -04:00
2019-03-21 15:21:19 -04:00
2021-08-23 16:10:30 -04:00

Spring Cloud Stream Testing with Embedded Kafka Broker Sample
==============================================================

In this *Spring Cloud Stream* sample, an embedded kafka broker is used for testing.

## Requirements

To run this sample, you will need to have installed:

* Java 8 or Above

## Code Tour

This sample is a Spring Boot application that uses Spring Cloud Stream to receive a `String` message and forward an upper case version of that String; it uses the Kafka binder.

* EmbeddedKafkaApplication - the Spring Boot Main Application
* EmbeddedKafkaApplicationTests - the test case

The `spring-kafka-test` dependency added to the `pom.xml` puts the `EmbeddedKafkaBroker` class on the class path.
Refer to the [Spring for Apache Kafka Reference Manual](https://docs.spring.io/spring-kafka/reference/htmlsingle/#testing) for more information about this.

See the test method for the details on interacting with Embedded Kafka.
The test method starts by sending a message to the input destination.
It then creates a consumer to consume from the output destination; gets the output message and asserts that it's an upper case version of the sent message.

## Building with Maven

Build the sample and run the test by executing:

`./mvnw clean package`

or run the test in your favorite IDE.