</parent>
<groupId>de.juplo.kafka</groupId>
- <artifactId>wordcount</artifactId>
+ <artifactId>sum</artifactId>
<version>1.0-SNAPSHOT</version>
- <name>Wordcount</name>
- <description>Splits the incomming sentences into words and counts the words per user.</description>
+ <name>Sum</name>
+ <description>Calculates the sum of all natuarl numbers up to the given natural number</description>
<dependencies>
<dependency>
<artifactId>de.flapdoodle.embed.mongo</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.assertj</groupId>
+ <artifactId>assertj-core</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
--- /dev/null
+package de.juplo.kafka;
+
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+
+import static org.assertj.core.api.Assertions.*;
+
+
+public class AdderBusinessLogicTest
+{
+ @Test
+ @DisplayName("A new sum can be started, if it does not exist")
+ public void testCanStartSumIfNotExists()
+ {
+ AdderBusinessLogic adder = new AdderBusinessLogic();
+ assertThatNoException().isThrownBy(() -> adder.startSum("foo"));
+ }
+
+ @Test
+ @DisplayName("Starting an already existing sum again, causes an IllegalStateException")
+ public void testStartSumCausesExceptionIfExists()
+ {
+ AdderBusinessLogic adder = new AdderBusinessLogic();
+ adder.startSum("foo");
+ assertThatIllegalStateException().isThrownBy(() -> adder.startSum("foo"));
+ }
+}