mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-12-19 07:00:35 +08:00
35 lines
822 B
Java
35 lines
822 B
Java
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);
|
|
}
|
|
}
|