Files
Java/src/test/java/com/thealgorithms/ciphers/BaconianCipherTest.java
2024-10-22 18:30:37 +00:00

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);
}
}