diff --git a/src/main/java/com/string/ReverseWords.java b/src/main/java/com/string/ReverseWords.java index fc9185c1..9a4dec90 100644 --- a/src/main/java/com/string/ReverseWords.java +++ b/src/main/java/com/string/ReverseWords.java @@ -1,4 +1,4 @@ -package com.strings; +package com.string; public class ReverseWords { /** @@ -8,7 +8,7 @@ public class ReverseWords { * @return the {@code String}, converted to a string with reveresed words. */ - public String returnReverseWords(String s) { + public static String returnReverseWords(String s) { StringBuilder sb = new StringBuilder(); StringBuilder word = new StringBuilder(); diff --git a/src/test/java/com/string/ReverseWordsTest.java b/src/test/java/com/string/ReverseWordsTest.java index 8cfb3b5b..590c50f8 100644 --- a/src/test/java/com/string/ReverseWordsTest.java +++ b/src/test/java/com/string/ReverseWordsTest.java @@ -3,13 +3,11 @@ package com.string; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -class ReveresWordsTest { +class ReverseWordsTest extends ReverseWords { @Test void testReverseWords() { - ReverseWords reverseWords = new ReverseWords(); - Assertions.assertEquals(true, reverseWords.returnReverseWords("this is my car"), "siht si ym rac"); - Assertions.assertEquals(true, reverseWords.returnReverseWords("ABC 123"), "CBA 321"); - + Assertions.assertEquals(true, returnReverseWords("this is my car").equals("siht si ym rac"), "Correct"); + Assertions.assertEquals(true, returnReverseWords("ABC 123").equals("CBA 321"), "Correct"); } } \ No newline at end of file