Skip to content

A lightweight Spring Boot application demonstrating how to configure Kafka Streams for testing. Includes examples of various testing strategies.

Notifications You must be signed in to change notification settings

roar-skinderviken/spring-kafka-streams-demo

Repository files navigation

spring-kafka-streams-demo

A lightweight Spring Boot application demonstrating how to configure Kafka Streams for testing. Includes examples of various testing strategies.

Overview

Topology Configuration

A topology for a very rudimentary card transaction fraud detection is defines in FraudDetectionTopologyConfig.

Testing Approaches

1. Unit Test with TopologyTestDriver

Tests the topology in isolation using Kafka Streams' TopologyTestDriver. See: FraudDetectionTopologyTestDriverTest.

2. Message Validation with KafkaTestUtils

Verifies that messages produced by the topology are correctly published to the output topic. This approach uses a consumer, KafkaTestUtils, and @EmbeddedKafka. See: FraudDetectionKafkaTestUtilsTest.

3. Integration Testing with @MockitoBean and @EmbeddedKafka

Validates that the expected service methods are invoked during the integration test. See: FraudDetectionIntegrationTest.

Prerequisites

  • Java 21+

Running Tests

./gradlew clean check --info

About

A lightweight Spring Boot application demonstrating how to configure Kafka Streams for testing. Includes examples of various testing strategies.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages