Add unit test for RSA cipher (#3664)

This commit is contained in:
Alexandre Velloso
2022-10-26 02:10:27 +01:00
committed by GitHub
parent f8897f166d
commit 8c6ed9c240
2 changed files with 30 additions and 23 deletions

View File

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