forked from TheAlgorithms/Java
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathElGamalEncryptionTest.java
More file actions
28 lines (24 loc) · 878 Bytes
/
ElGamalEncryptionTest.java
File metadata and controls
28 lines (24 loc) · 878 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
package com.thealgorithms.ciphers;
import org.junit.jupiter.api.Test;
import java.lang.reflect.Constructor;
import java.lang.reflect.Modifier;
import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Unit tests for {@link ElGamalEncryption}.
*/
public class ElGamalEncryptionTest {
@Test
void testEncryptionDecryption() {
try {
ElGamalEncryption.runElGamal("Hello", 64);
} catch (Exception e) {
throw new AssertionError("ElGamalEncryption failed with exception: " + e.getMessage());
}
}
@Test
void testUtilityConstructor() throws NoSuchMethodException {
Constructor<ElGamalEncryption> constructor = ElGamalEncryption.class.getDeclaredConstructor();
assertTrue(Modifier.isPrivate(constructor.getModifiers()),
"Utility class constructor should be private");
}
}