Skip to content

Commit 9e9ac3a

Browse files
add displayname annotations to simple-cipher
1 parent bae3583 commit 9e9ac3a

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

exercises/practice/simple-cipher/src/test/java/SimpleCipherTest.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import org.junit.jupiter.api.BeforeEach;
22
import org.junit.jupiter.api.Disabled;
3+
import org.junit.jupiter.api.DisplayName;
34
import org.junit.jupiter.api.Test;
45

56
import static org.assertj.core.api.Assertions.assertThat;
@@ -18,6 +19,7 @@ public void setup() {
1819
* problem with shift ciphers, some characters will always output the key verbatim.
1920
*/
2021
@Test
22+
@DisplayName("Can encode")
2123
public void randomKeyCipherCanEncode() {
2224
String plainText = "aaaaaaaaaa";
2325
String cipherText = randomKeyCipher.getKey().substring(0, 10);
@@ -26,6 +28,7 @@ public void randomKeyCipherCanEncode() {
2628

2729
@Disabled("Remove to run test")
2830
@Test
31+
@DisplayName("Can decode")
2932
public void randomKeyCipherCanDecode() {
3033
String cipherText = "aaaaaaaaaa";
3134
assertThat(randomKeyCipher.decode(randomKeyCipher.getKey().substring(0, 10)))
@@ -34,19 +37,23 @@ public void randomKeyCipherCanDecode() {
3437

3538
@Disabled("Remove to run test")
3639
@Test
40+
@DisplayName("Is reversible. I.e., if you apply decode in a encoded result, \n" +
41+
"you must see the same plaintext encode parameter as a result of the decode method")
3742
public void randomKeyCipherIsReversible() {
3843
String plainText = "abcdefghij";
3944
assertThat(randomKeyCipher.decode(randomKeyCipher.encode(plainText))).isEqualTo(plainText);
4045
}
4146

4247
@Disabled("Remove to run test")
4348
@Test
49+
@DisplayName("Key is made only of lowercase letters")
4450
public void randomKeyCipherKeyIsLowercaseLetters() {
4551
assertThat(randomKeyCipher.getKey()).matches("^[a-z]+$");
4652
}
4753

4854
@Disabled("Remove to run test")
4955
@Test
56+
@DisplayName("Can encode")
5057
public void substitutionCipherCanEncode() {
5158
String plainText = "aaaaaaaaaa";
5259
String cipherText = "abcdefghij";
@@ -55,6 +62,7 @@ public void substitutionCipherCanEncode() {
5562

5663
@Disabled("Remove to run test")
5764
@Test
65+
@DisplayName("Can decode")
5866
public void substitutionCipherCanDecode() {
5967
String plainText = "abcdefghij";
6068
String cipherText = "aaaaaaaaaa";
@@ -63,13 +71,16 @@ public void substitutionCipherCanDecode() {
6371

6472
@Disabled("Remove to run test")
6573
@Test
74+
@DisplayName("Is reversible. I.e., if you apply decode in a encoded result, \n" +
75+
"you must see the same plaintext encode parameter as a result of the decode method")
6676
public void substitutionCipherIsReversibleGivenKey() {
6777
String plainText = "abcdefghij";
6878
assertThat(substitutionCipher.decode(substitutionCipher.encode(plainText))).isEqualTo(plainText);
6979
}
7080

7181
@Disabled("Remove to run test")
7282
@Test
83+
@DisplayName("Can double shift encode")
7384
public void substitutionCipherCanDoubleShiftEncode() {
7485
String plainText = "iamapandabear";
7586
String cipherText = "qayaeaagaciai";
@@ -78,6 +89,7 @@ public void substitutionCipherCanDoubleShiftEncode() {
7889

7990
@Disabled("Remove to run test")
8091
@Test
92+
@DisplayName("Can wrap on encode")
8193
public void substitutionCipherCanWrapEncode() {
8294
String plainText = "zzzzzzzzzz";
8395
String cipherText = "zabcdefghi";
@@ -86,6 +98,7 @@ public void substitutionCipherCanWrapEncode() {
8698

8799
@Disabled("Remove to run test")
88100
@Test
101+
@DisplayName("Can wrap on decode")
89102
public void substitutionCipherCanWrapDecode() {
90103
String plainText = "zabcdefghi";
91104
String cipherText = "zzzzzzzzzz";
@@ -94,6 +107,7 @@ public void substitutionCipherCanWrapDecode() {
94107

95108
@Disabled("Remove to run test")
96109
@Test
110+
@DisplayName("Can decode messages longer than the key")
97111
public void substitutionCipherMessageLongerThanKey() {
98112
String plainText = "iamapandabear";
99113
String key = "abc";

0 commit comments

Comments
 (0)