diff --git a/kata/7-kyu/mew-cipher/main/ForemanPig.java b/kata/7-kyu/mew-cipher/main/MewCipher.java similarity index 94% rename from kata/7-kyu/mew-cipher/main/ForemanPig.java rename to kata/7-kyu/mew-cipher/main/MewCipher.java index e1c9061df..e3598ac4f 100644 --- a/kata/7-kyu/mew-cipher/main/ForemanPig.java +++ b/kata/7-kyu/mew-cipher/main/MewCipher.java @@ -1,7 +1,7 @@ import static java.util.stream.Collectors.joining; import static java.util.stream.IntStream.range; -interface ForemanPig { +interface MewCipher { static String decipher(String[] code) { return range(0, code[0].length()) .map(i -> range(0, code.length).reduce(0, (s, j) -> s + (code[j].charAt(i) & 31)) / code.length) diff --git a/kata/7-kyu/mew-cipher/test/ForemanPigTest.java b/kata/7-kyu/mew-cipher/test/ForemanPigTest.java deleted file mode 100644 index cec6fda67..000000000 --- a/kata/7-kyu/mew-cipher/test/ForemanPigTest.java +++ /dev/null @@ -1,14 +0,0 @@ -import static org.junit.jupiter.api.Assertions.assertEquals; - -import org.junit.jupiter.api.Test; - -class ForemanPigTest { - @Test - void sample() { - assertEquals("walk your dog at nine", ForemanPig.decipher(new String[]{"u lk zxuq hfk as fouh", "y l zpuv xe at sicd", "welvayfuqbfpeaauaqcrc"})); - assertEquals("hello world", ForemanPig.decipher(new String[]{"hello world"})); - assertEquals("", ForemanPig.decipher(new String[]{"", "", "", "", ""})); - assertEquals(" ", ForemanPig.decipher(new String[]{"a ", " b ", " c", " ", " "})); - assertEquals("foreman pig", ForemanPig.decipher(new String[]{"foreman pig", "foreman pig"})); - } -} \ No newline at end of file diff --git a/kata/7-kyu/mew-cipher/test/MewCipherTest.java b/kata/7-kyu/mew-cipher/test/MewCipherTest.java new file mode 100644 index 000000000..8c709e363 --- /dev/null +++ b/kata/7-kyu/mew-cipher/test/MewCipherTest.java @@ -0,0 +1,14 @@ +import static org.junit.jupiter.api.Assertions.assertEquals; + +import org.junit.jupiter.api.Test; + +class MewCipherTest { + @Test + void sample() { + assertEquals("walk your dog at nine", MewCipher.decipher(new String[]{"u lk zxuq hfk as fouh", "y l zpuv xe at sicd", "welvayfuqbfpeaauaqcrc"})); + assertEquals("hello world", MewCipher.decipher(new String[]{"hello world"})); + assertEquals("", MewCipher.decipher(new String[]{"", "", "", "", ""})); + assertEquals(" ", MewCipher.decipher(new String[]{"a ", " b ", " c", " ", " "})); + assertEquals("foreman pig", MewCipher.decipher(new String[]{"foreman pig", "foreman pig"})); + } +} \ No newline at end of file