From 23c58a6fdc23b3e79f7851daea5731b124d138c1 Mon Sep 17 00:00:00 2001 From: Mattrixwv Date: Sun, 25 Jul 2021 16:59:32 -0400 Subject: [PATCH] Updated test message --- .../java/mattrixwv/CipherStreamJava/Caesar.java | 2 +- .../mattrixwv/CipherStreamJava/TestCaesar.java | 17 +++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/main/java/mattrixwv/CipherStreamJava/Caesar.java b/src/main/java/mattrixwv/CipherStreamJava/Caesar.java index f4fefc4..0dc6e24 100644 --- a/src/main/java/mattrixwv/CipherStreamJava/Caesar.java +++ b/src/main/java/mattrixwv/CipherStreamJava/Caesar.java @@ -7,9 +7,9 @@ package mattrixwv.CipherStreamJava; public class Caesar{ + public static final String version = "1.0"; //The current version number for the library private String inputString; //The string that needs encoded/decoded private String outputString; //The encoded/decoded string - public static final String version = "1.0"; //The current version number for the library private int shift; //The amount that you need to shift each letter //Sets shift and makes sure it is within the propper bounds private void setShift(int shiftAmount){ diff --git a/src/test/java/mattrixwv/CipherStreamJava/TestCaesar.java b/src/test/java/mattrixwv/CipherStreamJava/TestCaesar.java index 998fcfe..f9bebb1 100644 --- a/src/test/java/mattrixwv/CipherStreamJava/TestCaesar.java +++ b/src/test/java/mattrixwv/CipherStreamJava/TestCaesar.java @@ -14,32 +14,33 @@ import org.junit.Test; public class TestCaesar{ @Test public void testDecode(){ - //Test 1 Caesar cipher = new Caesar(); + + //Test 1 String input = "def"; int shift = 3; String correctOutput = "abc"; String output = cipher.decode(shift, input); - assertEquals("Caesar Decoding failed the first test - Expected: " + correctOutput + "; actual: " + output, correctOutput, output); + assertEquals("Caesar Decoding failed the first test", correctOutput, output); //Test 2 input = "def"; shift = 29; correctOutput = "abc"; output = cipher.decode(shift, input); - assertEquals("Caesar Decoding failed the second test - Expected: " + correctOutput + "; actual: " + output, correctOutput, output); + assertEquals("Caesar Decoding failed the second test", correctOutput, output); //Test 3 input = "Qeb nrfzh yoltk clu grjmp lsbo - qeb ixwv ald"; shift = -3; correctOutput = "The quick brown fox jumps over - the lazy dog"; output = cipher.decode(shift, input); - assertEquals("Caesar Decoding failed the third test - Expected: " + correctOutput + "; actual: " + output, correctOutput, output); + assertEquals("Caesar Decoding failed the third test", correctOutput, output); //Test 4 input = "Qeb nrfzh yoltk clu grjmp lsbo - qeb ixwv ald"; shift = 23; correctOutput = "The quick brown fox jumps over - the lazy dog"; output = cipher.decode(shift, input); - assertEquals("Caesar Decoding failed the fourth test - Expected: " + correctOutput + "; actual: " + output, correctOutput, output); + assertEquals("Caesar Decoding failed the fourth test", correctOutput, output); } @Test public void testEncode(){ @@ -49,7 +50,7 @@ public class TestCaesar{ int shift = 3; String correctOutput = "def"; String output = cipher.encode(shift, input); - assertEquals("Caesar Encoding failed the first test - Expected: " + correctOutput + "; actual: " + output, correctOutput, output); + assertEquals("Caesar Encoding failed the first test", correctOutput, output); //Test 2 input = "abc"; shift = 29; @@ -62,12 +63,12 @@ public class TestCaesar{ shift = -3; correctOutput = "Qeb nrfzh yoltk clu grjmp lsbo - qeb ixwv ald"; output = cipher.encode(shift, input); - assertEquals("Caesar Encoding failed the third test - Expected: " + correctOutput + "; actual: " + output, correctOutput, output); + assertEquals("Caesar Encoding failed the third test", correctOutput, output); //Test 4 input = "The quick brown fox jumps over - the lazy dog"; shift = 23; correctOutput = "Qeb nrfzh yoltk clu grjmp lsbo - qeb ixwv ald"; output = cipher.encode(shift, input); - assertEquals("Caesar Encoding failed the third test - Expected: " + correctOutput + "; actual: " + output, correctOutput, output); + assertEquals("Caesar Encoding failed the third test", correctOutput, output); } }