Updated test message
This commit is contained in:
@@ -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){
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user