From 63c75f1f8679ceaaa5cb2a836445a20b0e8da3c7 Mon Sep 17 00:00:00 2001 From: Paul Schaub Date: Sat, 3 Jul 2021 12:42:12 +0200 Subject: [PATCH] Rename TestUtil -> TestImplementationFactoryProvider --- .../DecryptAndVerifyMessageTest.java | 2 +- .../DecryptHiddenRecipientMessage.java | 2 +- .../ModificationDetectionTests.java | 6 +++--- .../RecursionDepthTest.java | 2 +- .../VerifyWithMissingPublicKeyCallback.java | 2 +- .../encryption_signing/EncryptDecryptTest.java | 16 ++++++++-------- .../EncryptionStreamClosedTest.java | 2 +- .../encryption_signing/SigningTest.java | 2 +- .../key/BouncycastleExportSubkeys.java | 2 +- .../org/pgpainless/key/ImportExportKeyTest.java | 2 +- .../generation/BrainpoolKeyGenerationTest.java | 4 ++-- .../CertificationKeyMustBeAbleToCertifyTest.java | 2 +- .../generation/GenerateEllipticCurveKeyTest.java | 2 +- .../key/generation/GenerateKeyTest.java | 2 +- .../GenerateKeyWithAdditionalUserIdTest.java | 2 +- .../generation/GenerateWithEmptyPassphrase.java | 2 +- .../key/generation/IllegalKeyFlagsTest.java | 2 +- .../org/pgpainless/key/info/KeyRingInfoTest.java | 6 +++--- .../key/modification/AddSubKeyTest.java | 2 +- .../key/modification/AddUserIdTest.java | 6 +++--- .../key/modification/ChangeExpirationTest.java | 4 ++-- .../ChangeSecretKeyRingPassphraseTest.java | 8 ++++---- ...dSignatureSubpacketsArePreservedOnNewSig.java | 2 +- ...KeyWithGenericCertificationSignatureTest.java | 2 +- ...eyWithoutPreferredAlgorithmsOnPrimaryKey.java | 2 +- .../key/modification/RevokeSubKeyTest.java | 6 +++--- .../protection/SecretKeyRingProtectorTest.java | 4 ++-- .../MultiPassphraseSymmetricEncryptionTest.java | 2 +- .../SymmetricEncryptionTest.java | 4 ++-- .../util/TestImplementationFactoryProvider.java} | 2 +- 30 files changed, 52 insertions(+), 52 deletions(-) rename pgpainless-core/src/{main/java/org/pgpainless/util/TestUtil.java => test/java/org/pgpainless/util/TestImplementationFactoryProvider.java} (96%) diff --git a/pgpainless-core/src/test/java/org/pgpainless/decryption_verification/DecryptAndVerifyMessageTest.java b/pgpainless-core/src/test/java/org/pgpainless/decryption_verification/DecryptAndVerifyMessageTest.java index c47f095f..7ff9edc4 100644 --- a/pgpainless-core/src/test/java/org/pgpainless/decryption_verification/DecryptAndVerifyMessageTest.java +++ b/pgpainless-core/src/test/java/org/pgpainless/decryption_verification/DecryptAndVerifyMessageTest.java @@ -52,7 +52,7 @@ public class DecryptAndVerifyMessageTest { } @ParameterizedTest - @MethodSource("org.pgpainless.util.TestUtil#provideImplementationFactories") + @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories") public void decryptMessageAndVerifySignatureTest(ImplementationFactory implementationFactory) throws Exception { ImplementationFactory.setFactoryImplementation(implementationFactory); String encryptedMessage = TestKeys.MSG_SIGN_CRYPT_JULIET_JULIET; diff --git a/pgpainless-core/src/test/java/org/pgpainless/decryption_verification/DecryptHiddenRecipientMessage.java b/pgpainless-core/src/test/java/org/pgpainless/decryption_verification/DecryptHiddenRecipientMessage.java index e86659c7..c3149493 100644 --- a/pgpainless-core/src/test/java/org/pgpainless/decryption_verification/DecryptHiddenRecipientMessage.java +++ b/pgpainless-core/src/test/java/org/pgpainless/decryption_verification/DecryptHiddenRecipientMessage.java @@ -38,7 +38,7 @@ import org.pgpainless.key.info.KeyRingInfo; public class DecryptHiddenRecipientMessage { @ParameterizedTest - @MethodSource("org.pgpainless.util.TestUtil#provideImplementationFactories") + @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories") public void testDecryptionWithWildcardRecipient(ImplementationFactory implementationFactory) throws IOException, PGPException { ImplementationFactory.setFactoryImplementation(implementationFactory); String secretKeyAscii = "-----BEGIN PGP PRIVATE KEY BLOCK-----\n" + diff --git a/pgpainless-core/src/test/java/org/pgpainless/decryption_verification/ModificationDetectionTests.java b/pgpainless-core/src/test/java/org/pgpainless/decryption_verification/ModificationDetectionTests.java index 0504aa23..cf116cc2 100644 --- a/pgpainless-core/src/test/java/org/pgpainless/decryption_verification/ModificationDetectionTests.java +++ b/pgpainless-core/src/test/java/org/pgpainless/decryption_verification/ModificationDetectionTests.java @@ -131,7 +131,7 @@ public class ModificationDetectionTests { * @throws PGPException in case of a pgp error */ @ParameterizedTest - @MethodSource("org.pgpainless.util.TestUtil#provideImplementationFactories") + @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories") public void testMissingMDC(ImplementationFactory implementationFactory) throws IOException, PGPException { ImplementationFactory.setFactoryImplementation(implementationFactory); String message = "-----BEGIN PGP MESSAGE-----\n" + @@ -166,7 +166,7 @@ public class ModificationDetectionTests { } @ParameterizedTest - @MethodSource("org.pgpainless.util.TestUtil#provideImplementationFactories") + @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories") public void tamperedCiphertextTest(ImplementationFactory implementationFactory) throws IOException, PGPException { ImplementationFactory.setFactoryImplementation(implementationFactory); String message = "-----BEGIN PGP MESSAGE-----\n" + @@ -197,7 +197,7 @@ public class ModificationDetectionTests { } @ParameterizedTest - @MethodSource("org.pgpainless.util.TestUtil#provideImplementationFactories") + @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories") public void tamperedMDCTest(ImplementationFactory implementationFactory) throws IOException, PGPException { ImplementationFactory.setFactoryImplementation(implementationFactory); String message = "-----BEGIN PGP MESSAGE-----\n" + diff --git a/pgpainless-core/src/test/java/org/pgpainless/decryption_verification/RecursionDepthTest.java b/pgpainless-core/src/test/java/org/pgpainless/decryption_verification/RecursionDepthTest.java index 3ec55359..5300bec9 100644 --- a/pgpainless-core/src/test/java/org/pgpainless/decryption_verification/RecursionDepthTest.java +++ b/pgpainless-core/src/test/java/org/pgpainless/decryption_verification/RecursionDepthTest.java @@ -38,7 +38,7 @@ public class RecursionDepthTest { * @see Sequoia-PGP Test Suite */ @ParameterizedTest - @MethodSource("org.pgpainless.util.TestUtil#provideImplementationFactories") + @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories") public void decryptionAbortsWhenMaximumRecursionDepthReachedTest(ImplementationFactory implementationFactory) throws IOException, PGPException { ImplementationFactory.setFactoryImplementation(implementationFactory); String key = "-----BEGIN PGP PRIVATE KEY BLOCK-----\n" + diff --git a/pgpainless-core/src/test/java/org/pgpainless/decryption_verification/VerifyWithMissingPublicKeyCallback.java b/pgpainless-core/src/test/java/org/pgpainless/decryption_verification/VerifyWithMissingPublicKeyCallback.java index 5efb51dc..ab59fb1c 100644 --- a/pgpainless-core/src/test/java/org/pgpainless/decryption_verification/VerifyWithMissingPublicKeyCallback.java +++ b/pgpainless-core/src/test/java/org/pgpainless/decryption_verification/VerifyWithMissingPublicKeyCallback.java @@ -48,7 +48,7 @@ import org.pgpainless.key.util.KeyRingUtils; /** * Test functionality of the {@link MissingPublicKeyCallback} which is called when during signature verification, * a signature is encountered which was made by a key that was not provided in - * {@link DecryptionBuilderInterface.VerifyWith#verifyWith(PGPPublicKeyRing)}. + * {@link ConsumerOptions#addVerificationCert(PGPPublicKeyRing)}. */ public class VerifyWithMissingPublicKeyCallback { diff --git a/pgpainless-core/src/test/java/org/pgpainless/encryption_signing/EncryptDecryptTest.java b/pgpainless-core/src/test/java/org/pgpainless/encryption_signing/EncryptDecryptTest.java index 50ba10b7..1fd80e02 100644 --- a/pgpainless-core/src/test/java/org/pgpainless/encryption_signing/EncryptDecryptTest.java +++ b/pgpainless-core/src/test/java/org/pgpainless/encryption_signing/EncryptDecryptTest.java @@ -82,7 +82,7 @@ public class EncryptDecryptTest { } @ParameterizedTest - @MethodSource("org.pgpainless.util.TestUtil#provideImplementationFactories") + @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories") public void freshKeysRsaToElGamalTest(ImplementationFactory implementationFactory) throws PGPException, NoSuchAlgorithmException, InvalidAlgorithmParameterException, IOException { ImplementationFactory.setFactoryImplementation(implementationFactory); @@ -96,7 +96,7 @@ public class EncryptDecryptTest { } @ParameterizedTest - @MethodSource("org.pgpainless.util.TestUtil#provideImplementationFactories") + @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories") public void freshKeysRsaToRsaTest(ImplementationFactory implementationFactory) throws PGPException, NoSuchAlgorithmException, InvalidAlgorithmParameterException, IOException { ImplementationFactory.setFactoryImplementation(implementationFactory); @@ -107,7 +107,7 @@ public class EncryptDecryptTest { } @ParameterizedTest - @MethodSource("org.pgpainless.util.TestUtil#provideImplementationFactories") + @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories") public void freshKeysEcToEcTest(ImplementationFactory implementationFactory) throws IOException, PGPException, NoSuchAlgorithmException, InvalidAlgorithmParameterException { ImplementationFactory.setFactoryImplementation(implementationFactory); @@ -118,7 +118,7 @@ public class EncryptDecryptTest { } @ParameterizedTest - @MethodSource("org.pgpainless.util.TestUtil#provideImplementationFactories") + @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories") public void freshKeysEcToRsaTest(ImplementationFactory implementationFactory) throws PGPException, NoSuchAlgorithmException, InvalidAlgorithmParameterException, IOException { ImplementationFactory.setFactoryImplementation(implementationFactory); @@ -129,7 +129,7 @@ public class EncryptDecryptTest { } @ParameterizedTest - @MethodSource("org.pgpainless.util.TestUtil#provideImplementationFactories") + @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories") public void freshKeysRsaToEcTest(ImplementationFactory implementationFactory) throws PGPException, NoSuchAlgorithmException, InvalidAlgorithmParameterException, IOException { ImplementationFactory.setFactoryImplementation(implementationFactory); @@ -140,7 +140,7 @@ public class EncryptDecryptTest { } @ParameterizedTest - @MethodSource("org.pgpainless.util.TestUtil#provideImplementationFactories") + @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories") public void existingRsaKeysTest(ImplementationFactory implementationFactory) throws IOException, PGPException { ImplementationFactory.setFactoryImplementation(implementationFactory); PGPSecretKeyRing sender = TestKeys.getJulietSecretKeyRing(); @@ -205,7 +205,7 @@ public class EncryptDecryptTest { } @ParameterizedTest - @MethodSource("org.pgpainless.util.TestUtil#provideImplementationFactories") + @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories") public void testDetachedSignatureCreationAndVerification(ImplementationFactory implementationFactory) throws IOException, PGPException { ImplementationFactory.setFactoryImplementation(implementationFactory); @@ -251,7 +251,7 @@ public class EncryptDecryptTest { } @ParameterizedTest - @MethodSource("org.pgpainless.util.TestUtil#provideImplementationFactories") + @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories") public void testOnePassSignatureCreationAndVerification(ImplementationFactory implementationFactory) throws IOException, PGPException { ImplementationFactory.setFactoryImplementation(implementationFactory); PGPSecretKeyRing signingKeys = TestKeys.getJulietSecretKeyRing(); diff --git a/pgpainless-core/src/test/java/org/pgpainless/encryption_signing/EncryptionStreamClosedTest.java b/pgpainless-core/src/test/java/org/pgpainless/encryption_signing/EncryptionStreamClosedTest.java index c3f8146c..efe34861 100644 --- a/pgpainless-core/src/test/java/org/pgpainless/encryption_signing/EncryptionStreamClosedTest.java +++ b/pgpainless-core/src/test/java/org/pgpainless/encryption_signing/EncryptionStreamClosedTest.java @@ -31,7 +31,7 @@ import org.pgpainless.util.Passphrase; public class EncryptionStreamClosedTest { @ParameterizedTest - @MethodSource("org.pgpainless.util.TestUtil#provideImplementationFactories") + @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories") public void testStreamHasToBeClosedBeforeGetResultCanBeCalled(ImplementationFactory implementationFactory) throws IOException, PGPException { ImplementationFactory.setFactoryImplementation(implementationFactory); OutputStream out = new ByteArrayOutputStream(); diff --git a/pgpainless-core/src/test/java/org/pgpainless/encryption_signing/SigningTest.java b/pgpainless-core/src/test/java/org/pgpainless/encryption_signing/SigningTest.java index ab03f45a..a40567aa 100644 --- a/pgpainless-core/src/test/java/org/pgpainless/encryption_signing/SigningTest.java +++ b/pgpainless-core/src/test/java/org/pgpainless/encryption_signing/SigningTest.java @@ -53,7 +53,7 @@ import org.pgpainless.util.Passphrase; public class SigningTest { @ParameterizedTest - @MethodSource("org.pgpainless.util.TestUtil#provideImplementationFactories") + @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories") public void testEncryptionAndSignatureVerification(ImplementationFactory implementationFactory) throws IOException, PGPException { ImplementationFactory.setFactoryImplementation(implementationFactory); diff --git a/pgpainless-core/src/test/java/org/pgpainless/key/BouncycastleExportSubkeys.java b/pgpainless-core/src/test/java/org/pgpainless/key/BouncycastleExportSubkeys.java index 3478502e..2b365631 100644 --- a/pgpainless-core/src/test/java/org/pgpainless/key/BouncycastleExportSubkeys.java +++ b/pgpainless-core/src/test/java/org/pgpainless/key/BouncycastleExportSubkeys.java @@ -48,7 +48,7 @@ import org.pgpainless.provider.ProviderFactory; public class BouncycastleExportSubkeys { @ParameterizedTest - @MethodSource("org.pgpainless.util.TestUtil#provideImplementationFactories") + @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories") public void testExportImport(ImplementationFactory implementationFactory) throws NoSuchAlgorithmException, InvalidAlgorithmParameterException, PGPException { ImplementationFactory.setFactoryImplementation(implementationFactory); KeyPairGenerator generator; diff --git a/pgpainless-core/src/test/java/org/pgpainless/key/ImportExportKeyTest.java b/pgpainless-core/src/test/java/org/pgpainless/key/ImportExportKeyTest.java index 22b0af1a..a69a77eb 100644 --- a/pgpainless-core/src/test/java/org/pgpainless/key/ImportExportKeyTest.java +++ b/pgpainless-core/src/test/java/org/pgpainless/key/ImportExportKeyTest.java @@ -36,7 +36,7 @@ public class ImportExportKeyTest { * @throws IOException in case of a IO error */ @ParameterizedTest - @MethodSource("org.pgpainless.util.TestUtil#provideImplementationFactories") + @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories") public void testExportImportPublicKeyRing(ImplementationFactory implementationFactory) throws IOException { ImplementationFactory.setFactoryImplementation(implementationFactory); PGPPublicKeyRing publicKeys = TestKeys.getJulietPublicKeyRing(); diff --git a/pgpainless-core/src/test/java/org/pgpainless/key/generation/BrainpoolKeyGenerationTest.java b/pgpainless-core/src/test/java/org/pgpainless/key/generation/BrainpoolKeyGenerationTest.java index fcfae805..8949726a 100644 --- a/pgpainless-core/src/test/java/org/pgpainless/key/generation/BrainpoolKeyGenerationTest.java +++ b/pgpainless-core/src/test/java/org/pgpainless/key/generation/BrainpoolKeyGenerationTest.java @@ -47,7 +47,7 @@ import org.pgpainless.util.Passphrase; public class BrainpoolKeyGenerationTest { @ParameterizedTest - @MethodSource("org.pgpainless.util.TestUtil#provideImplementationFactories") + @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories") public void generateEcKeysTest(ImplementationFactory implementationFactory) throws InvalidAlgorithmParameterException, NoSuchAlgorithmException, PGPException { ImplementationFactory.setFactoryImplementation(implementationFactory); @@ -79,7 +79,7 @@ public class BrainpoolKeyGenerationTest { } @ParameterizedTest - @MethodSource("org.pgpainless.util.TestUtil#provideImplementationFactories") + @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories") public void generateEdDSAKeyTest(ImplementationFactory implementationFactory) throws PGPException, InvalidAlgorithmParameterException, NoSuchAlgorithmException { ImplementationFactory.setFactoryImplementation(implementationFactory); diff --git a/pgpainless-core/src/test/java/org/pgpainless/key/generation/CertificationKeyMustBeAbleToCertifyTest.java b/pgpainless-core/src/test/java/org/pgpainless/key/generation/CertificationKeyMustBeAbleToCertifyTest.java index 5c276542..9a631e15 100644 --- a/pgpainless-core/src/test/java/org/pgpainless/key/generation/CertificationKeyMustBeAbleToCertifyTest.java +++ b/pgpainless-core/src/test/java/org/pgpainless/key/generation/CertificationKeyMustBeAbleToCertifyTest.java @@ -34,7 +34,7 @@ public class CertificationKeyMustBeAbleToCertifyTest { * This test therefore verifies that generating such keys fails. */ @ParameterizedTest - @MethodSource("org.pgpainless.util.TestUtil#provideImplementationFactories") + @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories") public void testCertificationIncapableKeyTypesThrow(ImplementationFactory implementationFactory) { ImplementationFactory.setFactoryImplementation(implementationFactory); KeyType[] typesIncapableOfCreatingVerifications = new KeyType[] { diff --git a/pgpainless-core/src/test/java/org/pgpainless/key/generation/GenerateEllipticCurveKeyTest.java b/pgpainless-core/src/test/java/org/pgpainless/key/generation/GenerateEllipticCurveKeyTest.java index 28d977b8..5c458b21 100644 --- a/pgpainless-core/src/test/java/org/pgpainless/key/generation/GenerateEllipticCurveKeyTest.java +++ b/pgpainless-core/src/test/java/org/pgpainless/key/generation/GenerateEllipticCurveKeyTest.java @@ -35,7 +35,7 @@ import org.pgpainless.util.ArmorUtils; public class GenerateEllipticCurveKeyTest { @ParameterizedTest - @MethodSource("org.pgpainless.util.TestUtil#provideImplementationFactories") + @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories") public void test(ImplementationFactory implementationFactory) throws InvalidAlgorithmParameterException, NoSuchAlgorithmException, PGPException, IOException { ImplementationFactory.setFactoryImplementation(implementationFactory); PGPSecretKeyRing keyRing = PGPainless.generateKeyRing() diff --git a/pgpainless-core/src/test/java/org/pgpainless/key/generation/GenerateKeyTest.java b/pgpainless-core/src/test/java/org/pgpainless/key/generation/GenerateKeyTest.java index affeac68..4cebb9a1 100644 --- a/pgpainless-core/src/test/java/org/pgpainless/key/generation/GenerateKeyTest.java +++ b/pgpainless-core/src/test/java/org/pgpainless/key/generation/GenerateKeyTest.java @@ -39,7 +39,7 @@ public class GenerateKeyTest { private static final Logger LOGGER = Logger.getLogger(GenerateKeyTest.class.getName()); @ParameterizedTest - @MethodSource("org.pgpainless.util.TestUtil#provideImplementationFactories") + @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories") public void generateKey(ImplementationFactory implementationFactory) throws InvalidAlgorithmParameterException, NoSuchAlgorithmException, PGPException, IOException { ImplementationFactory.setFactoryImplementation(implementationFactory); diff --git a/pgpainless-core/src/test/java/org/pgpainless/key/generation/GenerateKeyWithAdditionalUserIdTest.java b/pgpainless-core/src/test/java/org/pgpainless/key/generation/GenerateKeyWithAdditionalUserIdTest.java index 4672a402..87df0011 100644 --- a/pgpainless-core/src/test/java/org/pgpainless/key/generation/GenerateKeyWithAdditionalUserIdTest.java +++ b/pgpainless-core/src/test/java/org/pgpainless/key/generation/GenerateKeyWithAdditionalUserIdTest.java @@ -44,7 +44,7 @@ import org.pgpainless.util.ArmoredOutputStreamFactory; public class GenerateKeyWithAdditionalUserIdTest { @ParameterizedTest - @MethodSource("org.pgpainless.util.TestUtil#provideImplementationFactories") + @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories") public void test(ImplementationFactory implementationFactory) throws InvalidAlgorithmParameterException, NoSuchAlgorithmException, PGPException, IOException { ImplementationFactory.setFactoryImplementation(implementationFactory); Date now = new Date(); diff --git a/pgpainless-core/src/test/java/org/pgpainless/key/generation/GenerateWithEmptyPassphrase.java b/pgpainless-core/src/test/java/org/pgpainless/key/generation/GenerateWithEmptyPassphrase.java index 28af382e..0cc02f86 100644 --- a/pgpainless-core/src/test/java/org/pgpainless/key/generation/GenerateWithEmptyPassphrase.java +++ b/pgpainless-core/src/test/java/org/pgpainless/key/generation/GenerateWithEmptyPassphrase.java @@ -41,7 +41,7 @@ import org.pgpainless.util.Passphrase; public class GenerateWithEmptyPassphrase { @ParameterizedTest - @MethodSource("org.pgpainless.util.TestUtil#provideImplementationFactories") + @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories") public void testGeneratingKeyWithEmptyPassphraseDoesNotThrow(ImplementationFactory implementationFactory) throws InvalidAlgorithmParameterException, NoSuchAlgorithmException, PGPException, IOException { ImplementationFactory.setFactoryImplementation(implementationFactory); diff --git a/pgpainless-core/src/test/java/org/pgpainless/key/generation/IllegalKeyFlagsTest.java b/pgpainless-core/src/test/java/org/pgpainless/key/generation/IllegalKeyFlagsTest.java index 427c986b..5803f6ef 100644 --- a/pgpainless-core/src/test/java/org/pgpainless/key/generation/IllegalKeyFlagsTest.java +++ b/pgpainless-core/src/test/java/org/pgpainless/key/generation/IllegalKeyFlagsTest.java @@ -29,7 +29,7 @@ import org.pgpainless.key.generation.type.xdh.XDHSpec; public class IllegalKeyFlagsTest { @ParameterizedTest - @MethodSource("org.pgpainless.util.TestUtil#provideImplementationFactories") + @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories") public void testKeyCannotCarryFlagsTest(ImplementationFactory implementationFactory) { ImplementationFactory.setFactoryImplementation(implementationFactory); assertThrows(IllegalArgumentException.class, () -> PGPainless.generateKeyRing() diff --git a/pgpainless-core/src/test/java/org/pgpainless/key/info/KeyRingInfoTest.java b/pgpainless-core/src/test/java/org/pgpainless/key/info/KeyRingInfoTest.java index af200f1b..7dd673d3 100644 --- a/pgpainless-core/src/test/java/org/pgpainless/key/info/KeyRingInfoTest.java +++ b/pgpainless-core/src/test/java/org/pgpainless/key/info/KeyRingInfoTest.java @@ -58,7 +58,7 @@ import org.pgpainless.util.Passphrase; public class KeyRingInfoTest { @ParameterizedTest - @MethodSource("org.pgpainless.util.TestUtil#provideImplementationFactories") + @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories") public void testWithEmilsKeys(ImplementationFactory implementationFactory) throws IOException, PGPException { ImplementationFactory.setFactoryImplementation(implementationFactory); @@ -165,7 +165,7 @@ public class KeyRingInfoTest { } @ParameterizedTest - @MethodSource("org.pgpainless.util.TestUtil#provideImplementationFactories") + @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories") public void dummyS2KTest(ImplementationFactory implementationFactory) throws PGPException, IOException { ImplementationFactory.setFactoryImplementation(implementationFactory); @@ -204,7 +204,7 @@ public class KeyRingInfoTest { } @ParameterizedTest - @MethodSource("org.pgpainless.util.TestUtil#provideImplementationFactories") + @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories") public void testGetKeysWithFlagsAndExpiry(ImplementationFactory implementationFactory) throws PGPException, InvalidAlgorithmParameterException, NoSuchAlgorithmException { ImplementationFactory.setFactoryImplementation(implementationFactory); diff --git a/pgpainless-core/src/test/java/org/pgpainless/key/modification/AddSubKeyTest.java b/pgpainless-core/src/test/java/org/pgpainless/key/modification/AddSubKeyTest.java index bb2dca10..fb4b6b4b 100644 --- a/pgpainless-core/src/test/java/org/pgpainless/key/modification/AddSubKeyTest.java +++ b/pgpainless-core/src/test/java/org/pgpainless/key/modification/AddSubKeyTest.java @@ -49,7 +49,7 @@ import org.pgpainless.util.Passphrase; public class AddSubKeyTest { @ParameterizedTest - @MethodSource("org.pgpainless.util.TestUtil#provideImplementationFactories") + @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories") public void testAddSubKey(ImplementationFactory implementationFactory) throws IOException, PGPException, InvalidAlgorithmParameterException, NoSuchAlgorithmException { ImplementationFactory.setFactoryImplementation(implementationFactory); PGPSecretKeyRing secretKeys = TestKeys.getCryptieSecretKeyRing(); diff --git a/pgpainless-core/src/test/java/org/pgpainless/key/modification/AddUserIdTest.java b/pgpainless-core/src/test/java/org/pgpainless/key/modification/AddUserIdTest.java index 82c92305..28fd7817 100644 --- a/pgpainless-core/src/test/java/org/pgpainless/key/modification/AddUserIdTest.java +++ b/pgpainless-core/src/test/java/org/pgpainless/key/modification/AddUserIdTest.java @@ -40,7 +40,7 @@ import org.pgpainless.util.Passphrase; public class AddUserIdTest { @ParameterizedTest - @MethodSource("org.pgpainless.util.TestUtil#provideImplementationFactories") + @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories") public void addUserIdToExistingKeyRing(ImplementationFactory implementationFactory) throws InvalidAlgorithmParameterException, NoSuchAlgorithmException, PGPException { ImplementationFactory.setFactoryImplementation(implementationFactory); PGPSecretKeyRing secretKeys = PGPainless.generateKeyRing().simpleEcKeyRing("alice@wonderland.lit", "rabb1th0le"); @@ -69,7 +69,7 @@ public class AddUserIdTest { } @ParameterizedTest - @MethodSource("org.pgpainless.util.TestUtil#provideImplementationFactories") + @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories") public void deleteUserId_noSuchElementExceptionForMissingUserId(ImplementationFactory implementationFactory) throws IOException, PGPException { ImplementationFactory.setFactoryImplementation(implementationFactory); @@ -79,7 +79,7 @@ public class AddUserIdTest { } @ParameterizedTest - @MethodSource("org.pgpainless.util.TestUtil#provideImplementationFactories") + @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories") public void deleteExistingAndAddNewUserIdToExistingKeyRing(ImplementationFactory implementationFactory) throws PGPException, IOException { ImplementationFactory.setFactoryImplementation(implementationFactory); diff --git a/pgpainless-core/src/test/java/org/pgpainless/key/modification/ChangeExpirationTest.java b/pgpainless-core/src/test/java/org/pgpainless/key/modification/ChangeExpirationTest.java index 36637d9d..56cc999f 100644 --- a/pgpainless-core/src/test/java/org/pgpainless/key/modification/ChangeExpirationTest.java +++ b/pgpainless-core/src/test/java/org/pgpainless/key/modification/ChangeExpirationTest.java @@ -39,7 +39,7 @@ public class ChangeExpirationTest { private final OpenPgpV4Fingerprint subKeyFingerprint = new OpenPgpV4Fingerprint("F73FDE6439ABE210B1AF4EDD273EF7A0C749807B"); @ParameterizedTest - @MethodSource("org.pgpainless.util.TestUtil#provideImplementationFactories") + @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories") public void setExpirationDateAndThenUnsetIt_OnPrimaryKey(ImplementationFactory implementationFactory) throws PGPException, IOException, InterruptedException { ImplementationFactory.setFactoryImplementation(implementationFactory); @@ -72,7 +72,7 @@ public class ChangeExpirationTest { } @ParameterizedTest - @MethodSource("org.pgpainless.util.TestUtil#provideImplementationFactories") + @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories") public void setExpirationDateAndThenUnsetIt_OnSubkey(ImplementationFactory implementationFactory) throws PGPException, IOException, InterruptedException { ImplementationFactory.setFactoryImplementation(implementationFactory); diff --git a/pgpainless-core/src/test/java/org/pgpainless/key/modification/ChangeSecretKeyRingPassphraseTest.java b/pgpainless-core/src/test/java/org/pgpainless/key/modification/ChangeSecretKeyRingPassphraseTest.java index 4c60f056..26ac9901 100644 --- a/pgpainless-core/src/test/java/org/pgpainless/key/modification/ChangeSecretKeyRingPassphraseTest.java +++ b/pgpainless-core/src/test/java/org/pgpainless/key/modification/ChangeSecretKeyRingPassphraseTest.java @@ -56,7 +56,7 @@ public class ChangeSecretKeyRingPassphraseTest { } @ParameterizedTest - @MethodSource("org.pgpainless.util.TestUtil#provideImplementationFactories") + @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories") public void changePassphraseOfWholeKeyRingTest(ImplementationFactory implementationFactory) throws PGPException { ImplementationFactory.setFactoryImplementation(implementationFactory); @@ -84,7 +84,7 @@ public class ChangeSecretKeyRingPassphraseTest { } @ParameterizedTest - @MethodSource("org.pgpainless.util.TestUtil#provideImplementationFactories") + @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories") public void changePassphraseOfWholeKeyRingToEmptyPassphrase(ImplementationFactory implementationFactory) throws PGPException, IOException { ImplementationFactory.setFactoryImplementation(implementationFactory); PGPSecretKeyRing secretKeys = PGPainless.modifyKeyRing(keyRing) @@ -102,7 +102,7 @@ public class ChangeSecretKeyRingPassphraseTest { } @ParameterizedTest - @MethodSource("org.pgpainless.util.TestUtil#provideImplementationFactories") + @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories") public void changePassphraseOfSingleSubkeyToNewPassphrase(ImplementationFactory implementationFactory) throws PGPException { ImplementationFactory.setFactoryImplementation(implementationFactory); @@ -139,7 +139,7 @@ public class ChangeSecretKeyRingPassphraseTest { } @ParameterizedTest - @MethodSource("org.pgpainless.util.TestUtil#provideImplementationFactories") + @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories") public void changePassphraseOfSingleSubkeyToEmptyPassphrase(ImplementationFactory implementationFactory) throws PGPException { ImplementationFactory.setFactoryImplementation(implementationFactory); diff --git a/pgpainless-core/src/test/java/org/pgpainless/key/modification/OldSignatureSubpacketsArePreservedOnNewSig.java b/pgpainless-core/src/test/java/org/pgpainless/key/modification/OldSignatureSubpacketsArePreservedOnNewSig.java index 23b346e8..316c3ea1 100644 --- a/pgpainless-core/src/test/java/org/pgpainless/key/modification/OldSignatureSubpacketsArePreservedOnNewSig.java +++ b/pgpainless-core/src/test/java/org/pgpainless/key/modification/OldSignatureSubpacketsArePreservedOnNewSig.java @@ -38,7 +38,7 @@ import org.pgpainless.key.protection.UnprotectedKeysProtector; public class OldSignatureSubpacketsArePreservedOnNewSig { @ParameterizedTest - @MethodSource("org.pgpainless.util.TestUtil#provideImplementationFactories") + @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories") public void verifyOldSignatureSubpacketsArePreservedOnNewExpirationDateSig(ImplementationFactory implementationFactory) throws InvalidAlgorithmParameterException, NoSuchAlgorithmException, PGPException, InterruptedException, IOException { ImplementationFactory.setFactoryImplementation(implementationFactory); diff --git a/pgpainless-core/src/test/java/org/pgpainless/key/modification/RevokeKeyWithGenericCertificationSignatureTest.java b/pgpainless-core/src/test/java/org/pgpainless/key/modification/RevokeKeyWithGenericCertificationSignatureTest.java index 2a577430..d8a5ff4e 100644 --- a/pgpainless-core/src/test/java/org/pgpainless/key/modification/RevokeKeyWithGenericCertificationSignatureTest.java +++ b/pgpainless-core/src/test/java/org/pgpainless/key/modification/RevokeKeyWithGenericCertificationSignatureTest.java @@ -75,7 +75,7 @@ public class RevokeKeyWithGenericCertificationSignatureTest { } @ParameterizedTest - @MethodSource("org.pgpainless.util.TestUtil#provideImplementationFactories") + @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories") public void test(ImplementationFactory implementationFactory) throws IOException, PGPException { ImplementationFactory.setFactoryImplementation(implementationFactory); revokeKey(SAMPLE_PRIVATE_KEY); // would crash previously diff --git a/pgpainless-core/src/test/java/org/pgpainless/key/modification/RevokeKeyWithoutPreferredAlgorithmsOnPrimaryKey.java b/pgpainless-core/src/test/java/org/pgpainless/key/modification/RevokeKeyWithoutPreferredAlgorithmsOnPrimaryKey.java index d0e9207e..dd7c9320 100644 --- a/pgpainless-core/src/test/java/org/pgpainless/key/modification/RevokeKeyWithoutPreferredAlgorithmsOnPrimaryKey.java +++ b/pgpainless-core/src/test/java/org/pgpainless/key/modification/RevokeKeyWithoutPreferredAlgorithmsOnPrimaryKey.java @@ -112,7 +112,7 @@ public class RevokeKeyWithoutPreferredAlgorithmsOnPrimaryKey { "-----END PGP PRIVATE KEY BLOCK-----"; @ParameterizedTest - @MethodSource("org.pgpainless.util.TestUtil#provideImplementationFactories") + @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories") public void testChangingExpirationTimeWithKeyWithoutPrefAlgos(ImplementationFactory implementationFactory) throws IOException, PGPException { ImplementationFactory.setFactoryImplementation(implementationFactory); Date expirationDate = new Date(); diff --git a/pgpainless-core/src/test/java/org/pgpainless/key/modification/RevokeSubKeyTest.java b/pgpainless-core/src/test/java/org/pgpainless/key/modification/RevokeSubKeyTest.java index 7c344a3e..7c26aa1b 100644 --- a/pgpainless-core/src/test/java/org/pgpainless/key/modification/RevokeSubKeyTest.java +++ b/pgpainless-core/src/test/java/org/pgpainless/key/modification/RevokeSubKeyTest.java @@ -46,7 +46,7 @@ import org.pgpainless.util.Passphrase; public class RevokeSubKeyTest { @ParameterizedTest - @MethodSource("org.pgpainless.util.TestUtil#provideImplementationFactories") + @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories") public void revokeSukeyTest(ImplementationFactory implementationFactory) throws IOException, PGPException { ImplementationFactory.setFactoryImplementation(implementationFactory); PGPSecretKeyRing secretKeys = TestKeys.getCryptieSecretKeyRing(); @@ -71,7 +71,7 @@ public class RevokeSubKeyTest { } @ParameterizedTest - @MethodSource("org.pgpainless.util.TestUtil#provideImplementationFactories") + @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories") public void detachedRevokeSubkeyTest(ImplementationFactory implementationFactory) throws IOException, PGPException { ImplementationFactory.setFactoryImplementation(implementationFactory); PGPSecretKeyRing secretKeys = TestKeys.getCryptieSecretKeyRing(); @@ -97,7 +97,7 @@ public class RevokeSubKeyTest { } @ParameterizedTest - @MethodSource("org.pgpainless.util.TestUtil#provideImplementationFactories") + @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories") public void testRevocationSignatureTypeCorrect(ImplementationFactory implementationFactory) throws IOException, PGPException { ImplementationFactory.setFactoryImplementation(implementationFactory); PGPSecretKeyRing secretKeys = TestKeys.getCryptieSecretKeyRing(); diff --git a/pgpainless-core/src/test/java/org/pgpainless/key/protection/SecretKeyRingProtectorTest.java b/pgpainless-core/src/test/java/org/pgpainless/key/protection/SecretKeyRingProtectorTest.java index 8c85ad69..dbbb398d 100644 --- a/pgpainless-core/src/test/java/org/pgpainless/key/protection/SecretKeyRingProtectorTest.java +++ b/pgpainless-core/src/test/java/org/pgpainless/key/protection/SecretKeyRingProtectorTest.java @@ -46,7 +46,7 @@ import org.pgpainless.util.Passphrase; public class SecretKeyRingProtectorTest { @ParameterizedTest - @MethodSource("org.pgpainless.util.TestUtil#provideImplementationFactories") + @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories") public void testUnlockAllKeysWithSamePassword(ImplementationFactory implementationFactory) throws IOException, PGPException, InvalidAlgorithmParameterException, NoSuchAlgorithmException { ImplementationFactory.setFactoryImplementation(implementationFactory); @@ -78,7 +78,7 @@ public class SecretKeyRingProtectorTest { } @ParameterizedTest - @MethodSource("org.pgpainless.util.TestUtil#provideImplementationFactories") + @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories") public void testUnlockSingleKeyWithPassphrase(ImplementationFactory implementationFactory) throws IOException, PGPException { ImplementationFactory.setFactoryImplementation(implementationFactory); diff --git a/pgpainless-core/src/test/java/org/pgpainless/symmetric_encryption/MultiPassphraseSymmetricEncryptionTest.java b/pgpainless-core/src/test/java/org/pgpainless/symmetric_encryption/MultiPassphraseSymmetricEncryptionTest.java index 8eb19130..dfbc8fe9 100644 --- a/pgpainless-core/src/test/java/org/pgpainless/symmetric_encryption/MultiPassphraseSymmetricEncryptionTest.java +++ b/pgpainless-core/src/test/java/org/pgpainless/symmetric_encryption/MultiPassphraseSymmetricEncryptionTest.java @@ -37,7 +37,7 @@ import org.pgpainless.util.Passphrase; public class MultiPassphraseSymmetricEncryptionTest { @ParameterizedTest - @MethodSource("org.pgpainless.util.TestUtil#provideImplementationFactories") + @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories") @Disabled public void encryptDecryptWithMultiplePassphrases(ImplementationFactory implementationFactory) throws IOException, PGPException { ImplementationFactory.setFactoryImplementation(implementationFactory); diff --git a/pgpainless-core/src/test/java/org/pgpainless/symmetric_encryption/SymmetricEncryptionTest.java b/pgpainless-core/src/test/java/org/pgpainless/symmetric_encryption/SymmetricEncryptionTest.java index b4bc4e72..15d6ab13 100644 --- a/pgpainless-core/src/test/java/org/pgpainless/symmetric_encryption/SymmetricEncryptionTest.java +++ b/pgpainless-core/src/test/java/org/pgpainless/symmetric_encryption/SymmetricEncryptionTest.java @@ -51,7 +51,7 @@ import org.pgpainless.util.Passphrase; public class SymmetricEncryptionTest { @ParameterizedTest - @MethodSource("org.pgpainless.util.TestUtil#provideImplementationFactories") + @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories") public void encryptWithKeyAndPassphrase_DecryptWithKey(ImplementationFactory implementationFactory) throws IOException, PGPException { ImplementationFactory.setFactoryImplementation(implementationFactory); byte[] plaintext = "This is a secret message".getBytes(StandardCharsets.UTF_8); @@ -105,7 +105,7 @@ public class SymmetricEncryptionTest { } @ParameterizedTest - @MethodSource("org.pgpainless.util.TestUtil#provideImplementationFactories") + @MethodSource("org.pgpainless.util.TestImplementationFactoryProvider#provideImplementationFactories") public void testMismatchPassphraseFails(ImplementationFactory implementationFactory) throws IOException, PGPException { ImplementationFactory.setFactoryImplementation(implementationFactory); diff --git a/pgpainless-core/src/main/java/org/pgpainless/util/TestUtil.java b/pgpainless-core/src/test/java/org/pgpainless/util/TestImplementationFactoryProvider.java similarity index 96% rename from pgpainless-core/src/main/java/org/pgpainless/util/TestUtil.java rename to pgpainless-core/src/test/java/org/pgpainless/util/TestImplementationFactoryProvider.java index 7c48800e..6e335c32 100644 --- a/pgpainless-core/src/main/java/org/pgpainless/util/TestUtil.java +++ b/pgpainless-core/src/test/java/org/pgpainless/util/TestImplementationFactoryProvider.java @@ -25,7 +25,7 @@ import java.util.List; /** * Utility class used to provide all available implementations of {@link ImplementationFactory} for parametrized tests. */ -public class TestUtil { +public class TestImplementationFactoryProvider { private static final List IMPLEMENTATIONS = Arrays.asList( new BcImplementationFactory(),