diff --git a/days/day007/pom.xml b/days/day007/pom.xml
index 1d94514..496fe37 100644
--- a/days/day007/pom.xml
+++ b/days/day007/pom.xml
@@ -11,5 +11,17 @@
day007
+
+
+ org.junit.jupiter
+ junit-jupiter-api
+ test
+
+
+ org.assertj
+ assertj-core
+ test
+
+
\ No newline at end of file
diff --git a/days/day007/src/main/java/com/thegreatapi/ahundreddaysofjava/day007/Day007.java b/days/day007/src/main/java/com/thegreatapi/ahundreddaysofjava/day007/Day007.java
deleted file mode 100644
index 3043d36..0000000
--- a/days/day007/src/main/java/com/thegreatapi/ahundreddaysofjava/day007/Day007.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package com.thegreatapi.ahundreddaysofjava.day007;
-
-import java.text.MessageFormat;
-
-public class Day007 {
-
- public static void main(String[] args) {
- showMessage("Java", "is", "great");
- }
-
- private static void showMessage(String param1, String param2, String param3) {
- String message = MessageFormat.format("This message contains 3 parameters. The #1 is ''{0}'', the #2 is ''{1}'', and the #3 is ''{2}''.",
- param1, param2, param3);
- System.out.println(message);
- }
-}
diff --git a/days/day007/src/test/java/com/thegreatapi/ahundreddaysofjava/day007/Day007Test.java b/days/day007/src/test/java/com/thegreatapi/ahundreddaysofjava/day007/Day007Test.java
new file mode 100644
index 0000000..8a4dd9c
--- /dev/null
+++ b/days/day007/src/test/java/com/thegreatapi/ahundreddaysofjava/day007/Day007Test.java
@@ -0,0 +1,46 @@
+package com.thegreatapi.ahundreddaysofjava.day007;
+
+import java.io.ByteArrayOutputStream;
+import java.io.PrintStream;
+import java.text.MessageFormat;
+import static org.assertj.core.api.Assertions.assertThat;
+import org.junit.jupiter.api.AfterEach;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+class Day007Test {
+
+ private final PrintStream standardOut = System.out;
+ private final ByteArrayOutputStream outputStreamCaptor = new ByteArrayOutputStream();
+
+ @BeforeEach
+ public void setUp() {
+ System.setOut(new PrintStream(outputStreamCaptor));
+ }
+
+ @Test
+ void shouldFormatMessageCorrectly() {
+ // Arrange
+ String param1 = "Hello";
+ String param2 = "World";
+ String param3 = "Java";
+
+ // Act
+ String actualMessage = MessageFormat.format(
+ "This message contains 3 parameters. The #1 is ''{0}'', "
+ + "the #2 is ''{1}'', and the #3 is ''{2}''.",
+ param1, param2, param3);
+
+ // Assert
+ String expectedMessage = "This message contains 3 parameters. The #1 is"
+ + " 'Hello', the #2 is 'World', and the #3 is 'Java'.";
+ assertThat(actualMessage).isEqualTo(expectedMessage);
+ //assertEquals(expectedMessage, outputStreamCaptor.toString().trim());
+ }
+
+ @AfterEach
+ public void tearDown() {
+ System.setOut(standardOut);
+ }
+}