-
Notifications
You must be signed in to change notification settings - Fork 19.7k
/
Copy pathPolybiusTest.java
45 lines (33 loc) · 974 Bytes
/
PolybiusTest.java
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
37
38
39
40
41
42
43
44
45
package com.thealgorithms.ciphers;
import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.Test;
public class PolybiusTest {
@Test
void testEncrypt() {
// Given
String plaintext = "HELLOWORLD";
// When
String actual = Polybius.encrypt(plaintext);
// Then
assertEquals("12042121244124322103", actual);
}
@Test
void testDecrypt() {
// Given
String ciphertext = "12042121244124322103";
// When
String actual = Polybius.decrypt(ciphertext);
// Then
assertEquals("HELLOWORLD", actual);
}
@Test
void testIsTextTheSameAfterEncryptionAndDecryption() {
// Given
String plaintext = "HELLOWORLD";
// When
String encryptedText = Polybius.encrypt(plaintext);
String actual = Polybius.decrypt(encryptedText);
// Then
assertEquals(plaintext, actual);
}
}