forked from TheAlgorithms/Java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAutokeyTest.java
More file actions
36 lines (26 loc) · 798 Bytes
/
AutokeyTest.java
File metadata and controls
36 lines (26 loc) · 798 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
35
36
package com.thealgorithms.ciphers;
import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.Test;
class AutokeyCipherTest {
Autokey autokeyCipher = new Autokey();
@Test
void autokeyEncryptTest() {
// given
String plaintext = "MEET AT DAWN";
String keyword = "QUEEN";
// when
String cipherText = autokeyCipher.encrypt(plaintext, keyword);
// then
assertEquals("CYIXNFHEPN", cipherText);
}
@Test
void autokeyDecryptTest() {
// given
String ciphertext = "CYIX NF HEPN";
String keyword = "QUEEN";
// when
String plainText = autokeyCipher.decrypt(ciphertext, keyword);
// then
assertEquals("MEETATDAWN", plainText);
}
}