Skip to content

Commit ef9442e

Browse files
committed
Add AtbashTest.java
1 parent d8fff40 commit ef9442e

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package com.thealgorithms.ciphers;
2+
3+
import static org.junit.jupiter.api.Assertions.assertEquals;
4+
5+
import org.junit.jupiter.api.Test;
6+
7+
public class AtbashTest {
8+
9+
@Test
10+
public void atbashEncrypt() {
11+
AtbashCipher normalToEncrypt = new AtbashCipher(
12+
"Hello World! 123, @cipher abcDEF ZYX 987 madam zzZ Palindrome!");
13+
String expectedText = "Svool Dliow! 123, @xrksvi zyxWVU ABC 987 nzwzn aaA Kzormwilnv!";
14+
15+
normalToEncrypt.setString(normalToEncrypt.convert());
16+
17+
assertEquals(expectedText, normalToEncrypt.getString());
18+
}
19+
20+
@Test
21+
public void atbashDecrypt() {
22+
AtbashCipher encryptToNormal = new AtbashCipher(
23+
"Svool Dliow! 123, @xrksvi zyxWVU ABC 987 nzwzn aaA Kzormwilnv!");
24+
String expectedText = "Hello World! 123, @cipher abcDEF ZYX 987 madam zzZ Palindrome!";
25+
26+
encryptToNormal.setString(encryptToNormal.convert());
27+
28+
assertEquals(expectedText, encryptToNormal.getString());
29+
}
30+
}

0 commit comments

Comments
 (0)