generated from GoodforGod/java-library-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from GoodforGod/dev
[0.6.2]
- Loading branch information
Showing
20 changed files
with
247 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
...st/java/io/goodforgod/testcontainers/extensions/kafka/KafkaContainerPerRunFirstTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package io.goodforgod.testcontainers.extensions.kafka; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
|
||
import io.goodforgod.testcontainers.extensions.ContainerMode; | ||
import org.junit.jupiter.api.MethodOrderer; | ||
import org.junit.jupiter.api.Order; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.TestMethodOrder; | ||
|
||
@TestcontainersKafka(mode = ContainerMode.PER_RUN) | ||
@TestMethodOrder(MethodOrderer.OrderAnnotation.class) | ||
class KafkaContainerPerRunFirstTests { | ||
|
||
static volatile KafkaConnection perRunConnection; | ||
|
||
@ContainerKafkaConnection | ||
private KafkaConnection sameConnection; | ||
|
||
@Order(1) | ||
@Test | ||
void firstConnection(@ContainerKafkaConnection KafkaConnection connection) { | ||
assertNotNull(connection); | ||
assertNotNull(connection.params().bootstrapServers()); | ||
assertNotNull(sameConnection); | ||
assertEquals(sameConnection, connection); | ||
|
||
if (perRunConnection == null) { | ||
perRunConnection = connection; | ||
} | ||
|
||
if (KafkaContainerPerRunSecondTests.perRunConnection != null) { | ||
assertEquals(perRunConnection, KafkaContainerPerRunSecondTests.perRunConnection); | ||
} | ||
|
||
connection.send("my-topic", Event.ofValue("my-value")); | ||
sameConnection.send("my-topic", Event.ofValue("my-value")); | ||
} | ||
|
||
@Order(2) | ||
@Test | ||
void secondConnection(@ContainerKafkaConnection KafkaConnection connection) { | ||
assertNotNull(connection); | ||
assertNotNull(connection.params().bootstrapServers()); | ||
assertNotNull(sameConnection); | ||
assertEquals(sameConnection, connection); | ||
assertEquals(perRunConnection, connection); | ||
|
||
connection.send("my-topic", Event.ofValue("my-value")); | ||
sameConnection.send("my-topic", Event.ofValue("my-value")); | ||
} | ||
} |
Oops, something went wrong.