Skip to content

Commit 33146c6

Browse files
committed
final Fix: SpotBugs violation and improve test for ElGamalEncryption
1 parent f646e48 commit 33146c6

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/main/java/com/thealgorithms/ciphers/ElGamalEncryption.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ private ElGamalEncryption() {
2626
* @param message the plaintext message to encrypt
2727
* @param bitLength the bit length for prime generation
2828
*/
29-
@SuppressWarnings({ "PMD.SystemPrintln", "PMD.DataflowAnomalyAnalysis" })
29+
@SuppressWarnings({"PMD.SystemPrintln", "PMD.DataflowAnomalyAnalysis"})
3030
public static void runElGamal(final String message, final int bitLength) {
3131
final BigInteger p = BigInteger.probablePrime(bitLength, RANDOM);
3232
final BigInteger g = new BigInteger("2");

src/test/java/com/thealgorithms/ciphers/ElGamalEncryptionTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
package com.thealgorithms.ciphers;
22

3-
import org.junit.jupiter.api.Test;
3+
import static org.junit.jupiter.api.Assertions.assertTrue;
4+
45
import java.lang.reflect.Constructor;
56
import java.lang.reflect.Modifier;
6-
import static org.junit.jupiter.api.Assertions.assertTrue;
7+
import org.junit.jupiter.api.Test;
78

89
/**
910
* Unit tests for {@link ElGamalEncryption}.
@@ -22,7 +23,6 @@ void testEncryptionDecryption() {
2223
@Test
2324
void testUtilityConstructor() throws NoSuchMethodException {
2425
Constructor<ElGamalEncryption> constructor = ElGamalEncryption.class.getDeclaredConstructor();
25-
assertTrue(Modifier.isPrivate(constructor.getModifiers()),
26-
"Utility class constructor should be private");
26+
assertTrue(Modifier.isPrivate(constructor.getModifiers()), "Utility class constructor should be private");
2727
}
2828
}

0 commit comments

Comments
 (0)