forked from TheAlgorithms/Java
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add unit test for RSA cipher (TheAlgorithms#3664)
- Loading branch information
1 parent
f8897f1
commit 8c6ed9c
Showing
2 changed files
with
30 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.thealgorithms.ciphers; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
class RSATest { | ||
|
||
RSA rsa = new RSA(1024); | ||
|
||
@Test | ||
void testRSA() { | ||
// given | ||
String textToEncrypt = "Such secure"; | ||
|
||
// when | ||
String cipherText = rsa.encrypt(textToEncrypt); | ||
String decryptedText = rsa.decrypt(cipherText); | ||
|
||
// then | ||
assertEquals("Such secure", decryptedText); | ||
} | ||
|
||
} |