forked from TheAlgorithms/Java
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathBaconianCipherTest.java
More file actions
34 lines (24 loc) · 822 Bytes
/
BaconianCipherTest.java
File metadata and controls
34 lines (24 loc) · 822 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package com.thealgorithms.ciphers;
import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.Test;
class BaconianCipherTest {
BaconianCipher baconianCipher = new BaconianCipher();
@Test
void baconianCipherEncryptTest() {
// given
String plaintext = "MEET AT DAWN";
// when
String cipherText = baconianCipher.encrypt(plaintext);
// then
assertEquals("ABBAAAABAAAABAABAABBAAAAABAABBAAABBAAAAABABBAABBAB", cipherText);
}
@Test
void baconianCipherDecryptTest() {
// given
String ciphertext = "ABBAAAABAAAABAABAABBAAAAABAABBAAABBAAAAABABBAABBAB";
// when
String plainText = baconianCipher.decrypt(ciphertext);
// then
assertEquals("MEETATDAWN", plainText);
}
}