|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
|
|
|
2
|
+import org.junit.Assert;
|
|
|
3
|
+import org.junit.Before;
|
|
|
4
|
+import org.junit.Ignore;
|
|
|
5
|
+import org.junit.Test;
|
|
|
6
|
+
|
|
|
7
|
+public class RotationalCipherTest {
|
|
|
8
|
+
|
|
|
9
|
+ private RotationalCipher rotationalCipher;
|
|
|
10
|
+
|
|
|
11
|
+ @Test
|
|
|
12
|
+ public void rotateSingleCharacterBy1() {
|
|
|
13
|
+ rotationalCipher = new RotationalCipher(1);
|
|
|
14
|
+ Assert.assertEquals("b", rotationalCipher.rotate("a"));
|
|
|
15
|
+ }
|
|
|
16
|
+
|
|
|
17
|
+ @Ignore("Remove to run test")
|
|
|
18
|
+ @Test
|
|
|
19
|
+ public void rotateSingleCharacterBy26() {
|
|
|
20
|
+ rotationalCipher = new RotationalCipher(26);
|
|
|
21
|
+ Assert.assertEquals("a", rotationalCipher.rotate("a"));
|
|
|
22
|
+ }
|
|
|
23
|
+
|
|
|
24
|
+ @Ignore("Remove to run test")
|
|
|
25
|
+ @Test
|
|
|
26
|
+ public void rotateSingleCharacterBy0() {
|
|
|
27
|
+ rotationalCipher = new RotationalCipher(0);
|
|
|
28
|
+ Assert.assertEquals("a", rotationalCipher.rotate("a"));
|
|
|
29
|
+ }
|
|
|
30
|
+
|
|
|
31
|
+ @Ignore("Remove to run test")
|
|
|
32
|
+ @Test
|
|
|
33
|
+ public void rotateSingleCharacterBy13() {
|
|
|
34
|
+ rotationalCipher = new RotationalCipher(13);
|
|
|
35
|
+ Assert.assertEquals("z", rotationalCipher.rotate("m"));
|
|
|
36
|
+ }
|
|
|
37
|
+
|
|
|
38
|
+ @Ignore("Remove to run test")
|
|
|
39
|
+ @Test
|
|
|
40
|
+ public void rotateSingleCharacterWithWrapAround() {
|
|
|
41
|
+ rotationalCipher = new RotationalCipher(13);
|
|
|
42
|
+ Assert.assertEquals("a", rotationalCipher.rotate("n"));
|
|
|
43
|
+ }
|
|
|
44
|
+
|
|
|
45
|
+ @Ignore("Remove to run test")
|
|
|
46
|
+ @Test
|
|
|
47
|
+ public void rotateCapitalLetters() {
|
|
|
48
|
+ rotationalCipher = new RotationalCipher(5);
|
|
|
49
|
+ Assert.assertEquals("TRL", rotationalCipher.rotate("OMG"));
|
|
|
50
|
+ }
|
|
|
51
|
+
|
|
|
52
|
+ @Ignore("Remove to run test")
|
|
|
53
|
+ @Test
|
|
|
54
|
+ public void rotateSpaces() {
|
|
|
55
|
+ rotationalCipher = new RotationalCipher(5);
|
|
|
56
|
+ Assert.assertEquals("T R L", rotationalCipher.rotate("O M G"));
|
|
|
57
|
+ }
|
|
|
58
|
+
|
|
|
59
|
+ @Ignore("Remove to run test")
|
|
|
60
|
+ @Test
|
|
|
61
|
+ public void rotateNumbers() {
|
|
|
62
|
+ rotationalCipher = new RotationalCipher(4);
|
|
|
63
|
+ Assert.assertEquals("Xiwxmrk 1 2 3 xiwxmrk", rotationalCipher.rotate("Testing 1 2 3 testing"));
|
|
|
64
|
+ }
|
|
|
65
|
+
|
|
|
66
|
+ @Ignore("Remove to run test")
|
|
|
67
|
+ @Test
|
|
|
68
|
+ public void rotatePunctuation() {
|
|
|
69
|
+ rotationalCipher = new RotationalCipher(21);
|
|
|
70
|
+ Assert.assertEquals("Gzo'n zvo, Bmviyhv!", rotationalCipher.rotate("Let's eat, Grandma!"));
|
|
|
71
|
+ }
|
|
|
72
|
+
|
|
|
73
|
+ @Ignore("Remove to run test")
|
|
|
74
|
+ @Test
|
|
|
75
|
+ public void rotateAllLetters() {
|
|
|
76
|
+ rotationalCipher = new RotationalCipher(13);
|
|
|
77
|
+ Assert.assertEquals("The quick brown fox jumps over the lazy dog.",
|
|
|
78
|
+ rotationalCipher.rotate("Gur dhvpx oebja sbk whzcf bire gur ynml qbt."));
|
|
|
79
|
+ }
|
|
|
80
|
+
|
|
|
81
|
+}
|