1
- import static org .assertj .core .api .Assertions .assertThat ;
2
- import static org .junit .Assert .assertEquals ;
3
- import static org .junit .Assert .assertThrows ;
4
-
5
1
import org .junit .Ignore ;
6
2
import org .junit .Test ;
7
3
4
+ import static org .assertj .core .api .Assertions .assertThat ;
5
+ import static org .junit .Assert .assertThrows ;
6
+
8
7
public class AffineCipherTest {
9
8
10
9
private AffineCipher affineCipher = new AffineCipher ();
11
10
12
11
@ Test
13
12
public void testEncodeYes () {
14
- assertEquals ( "xbt" , affineCipher .encode ("yes" , 5 , 7 ));
13
+ assertThat ( affineCipher .encode ("yes" , 5 , 7 )). isEqualTo ( "xbt" );
15
14
}
16
15
17
16
@ Ignore ("Remove to run test" )
18
17
@ Test
19
18
public void testEncodeNo () {
20
- assertEquals ( "fu" , affineCipher .encode ("no" , 15 , 18 ));
19
+ assertThat ( affineCipher .encode ("no" , 15 , 18 )). isEqualTo ( "fu" );
21
20
}
22
21
23
22
24
23
@ Ignore ("Remove to run test" )
25
24
@ Test
26
25
public void testEncodeOMG () {
27
- assertEquals ( "lvz" , affineCipher .encode ("OMG" , 21 , 3 ));
26
+ assertThat ( affineCipher .encode ("OMG" , 21 , 3 )). isEqualTo ( "lvz" );
28
27
}
29
28
30
29
@ Ignore ("Remove to run test" )
31
30
@ Test
32
31
public void testEncodeO_M_G () {
33
- assertEquals ( "hjp" , affineCipher .encode ("O M G" , 25 , 47 ));
32
+ assertThat ( affineCipher .encode ("O M G" , 25 , 47 )). isEqualTo ( "hjp" );
34
33
}
35
34
36
35
@ Ignore ("Remove to run test" )
37
36
@ Test
38
37
public void testEncodeMindBlowingly () {
39
- assertEquals ( "rzcwa gnxzc dgt" , affineCipher .encode ("mindblowingly" , 11 , 15 ));
38
+ assertThat ( affineCipher .encode ("mindblowingly" , 11 , 15 )). isEqualTo ( "rzcwa gnxzc dgt" );
40
39
}
41
40
42
41
@ Ignore ("Remove to run test" )
43
42
@ Test
44
43
public void testEncodeNumbers () {
45
- assertEquals ( "jqgjc rw123 jqgjc rw" ,
46
- affineCipher . encode ( "Testing,1 2 3, testing." , 3 , 4 ) );
44
+ assertThat ( affineCipher . encode ( "Testing,1 2 3, testing." , 3 , 4 ))
45
+ . isEqualTo ( "jqgjc rw123 jqgjc rw" );
47
46
}
48
47
49
48
@ Ignore ("Remove to run test" )
50
49
@ Test
51
50
public void testEncodeDeepThought () {
52
- assertEquals ( "iynia fdqfb ifje" ,
53
- affineCipher . encode ( "Truth is fiction." , 5 , 17 ) );
51
+ assertThat ( affineCipher . encode ( "Truth is fiction." , 5 , 17 ))
52
+ . isEqualTo ( "iynia fdqfb ifje" );
54
53
}
55
54
56
55
@ Ignore ("Remove to run test" )
57
56
@ Test
58
57
public void testEncodeAllTheLetters () {
59
- assertEquals ( "swxtj npvyk lruol iejdc blaxk swxmh qzglf" ,
60
- affineCipher . encode ( "The quick brown fox jumps over the lazy dog." , 17 , 33 ) );
58
+ assertThat ( affineCipher . encode ( "The quick brown fox jumps over the lazy dog." , 17 , 33 ))
59
+ . isEqualTo ( "swxtj npvyk lruol iejdc blaxk swxmh qzglf" );
61
60
}
62
61
63
62
@ Ignore ("Remove to run test" )
@@ -75,40 +74,43 @@ public void testEncodeThrowsMeaningfulException() {
75
74
@ Ignore ("Remove to run test" )
76
75
@ Test
77
76
public void testDecodeExercism () {
78
- assertEquals ("exercism" , affineCipher .decode ("tytgn fjr" , 3 , 7 ));
77
+ assertThat (affineCipher .decode ("tytgn fjr" , 3 , 7 ))
78
+ .isEqualTo ("exercism" );
79
79
}
80
80
81
81
@ Ignore ("Remove to run test" )
82
82
@ Test
83
83
public void testDecodeSentence () {
84
- assertEquals ( "anobstacleisoftenasteppingstone" ,
85
- affineCipher . decode ( "qdwju nqcro muwhn odqun oppmd aunwd o" , 19 , 16 ) );
84
+ assertThat ( affineCipher . decode ( "qdwju nqcro muwhn odqun oppmd aunwd o" , 19 , 16 ))
85
+ . isEqualTo ( "anobstacleisoftenasteppingstone" );
86
86
}
87
87
88
88
@ Ignore ("Remove to run test" )
89
89
@ Test
90
90
public void testDecodeNumbers () {
91
- assertEquals ("testing123testing" , affineCipher .decode ("odpoz ub123 odpoz ub" , 25 , 7 ));
91
+ assertThat (affineCipher .decode ("odpoz ub123 odpoz ub" , 25 , 7 ))
92
+ .isEqualTo ("testing123testing" );
92
93
}
93
94
94
95
@ Ignore ("Remove to run test" )
95
96
@ Test
96
97
public void testDecodeAllTheLetters () {
97
- assertEquals ( "thequickbrownfoxjumpsoverthelazydog" ,
98
- affineCipher . decode ( "swxtj npvyk lruol iejdc blaxk swxmh qzglf" , 17 , 33 ) );
98
+ assertThat ( affineCipher . decode ( "swxtj npvyk lruol iejdc blaxk swxmh qzglf" , 17 , 33 ))
99
+ . isEqualTo ( "thequickbrownfoxjumpsoverthelazydog" );
99
100
}
100
101
101
102
@ Ignore ("Remove to run test" )
102
103
@ Test
103
104
public void testDecodeWithNoSpaces () {
104
- assertEquals ( "thequickbrownfoxjumpsoverthelazydog" ,
105
- affineCipher . decode ( "swxtjnpvyklruoliejdcblaxkswxmhqzglf" , 17 , 33 ) );
105
+ assertThat ( affineCipher . decode ( "swxtjnpvyklruoliejdcblaxkswxmhqzglf" , 17 , 33 ))
106
+ . isEqualTo ( "thequickbrownfoxjumpsoverthelazydog" );
106
107
}
107
108
108
109
@ Ignore ("Remove to run test" )
109
110
@ Test
110
111
public void testDecodeWithTooManySpaces () {
111
- assertEquals ("jollygreengiant" , affineCipher .decode ("vszzm cly yd cg qdp" , 15 , 16 ));
112
+ assertThat (affineCipher .decode ("vszzm cly yd cg qdp" , 15 , 16 ))
113
+ .isEqualTo ("jollygreengiant" );
112
114
}
113
115
114
116
@ Ignore ("Remove to run test" )
0 commit comments