Skip to content

Commit 78a9944

Browse files
garyrussellartembilan
authored andcommitted
GH-2490: Add JUnit Platform Test Dependency
Resolves #2490 The new global embedded kafka broker depends on the JUnit platform launcher. With gradle, the launcher must be on the test runtime class path. Add the launcher as a transitive dependency. Tested with gradle and maven Boot apps.
1 parent 46372df commit 78a9944

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ project ('spring-kafka-test') {
408408
api "org.apache.kafka:kafka_$scalaVersion:$kafkaVersion"
409409
api "org.apache.kafka:kafka_$scalaVersion:$kafkaVersion:test"
410410
api 'org.junit.jupiter:junit-jupiter-api'
411-
providedApi 'org.junit.platform:junit-platform-launcher'
411+
api 'org.junit.platform:junit-platform-launcher'
412412
optionalApi "org.hamcrest:hamcrest-core:$hamcrestVersion"
413413
optionalApi "org.mockito:mockito-core:$mockitoVersion"
414414
optionalApi ("junit:junit:$junit4Version") {

spring-kafka-docs/src/main/asciidoc/testing.adoc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,9 @@ For example, a `spring.embedded.kafka.brokers.property=spring.kafka.bootstrap-se
240240
NOTE: It is recommended to not combine a global embedded Kafka and per-test class in a single test suite.
241241
Both of them share the same system properties, so it is very likely going to lead to unexpected behavior.
242242

243+
NOTE: `spring-kafka-test` has transitive dependencies on `junit-jupiter-api` and `junit-platform-launcher` (the latter to support the global embedded broker).
244+
If you wish to use the embedded broker and are NOT using JUnit, you may wish to exclude these dependencies.
245+
243246
[[embedded-kafka-annotation]]
244247
==== @EmbeddedKafka Annotation
245248
We generally recommend that you use the rule as a `@ClassRule` to avoid starting and stopping the broker between tests (and use a different topic for each test).

0 commit comments

Comments
 (0)