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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118
|
From: =?utf-8?b?SsOpcsO0bWUgQ2hhcmFvdWk=?= <jerome@riseup.net>
Date: Wed, 20 Jul 2022 11:50:18 -0400
Subject: remove mockito-based tests
Forwarded: not-needed
---
pgpainless-core/build.gradle | 3 -
.../pgpainless/key/OpenPgpV5FingerprintTest.java | 78 ----------------------
2 files changed, 81 deletions(-)
diff --git a/pgpainless-core/build.gradle b/pgpainless-core/build.gradle
index f1b852c..50cbb70 100644
--- a/pgpainless-core/build.gradle
+++ b/pgpainless-core/build.gradle
@@ -12,9 +12,6 @@ dependencies {
testImplementation "org.junit.jupiter:junit-jupiter-params:$junitVersion"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junitVersion"
- // Mocking Components
- testImplementation "org.mockito:mockito-core:$mockitoVersion"
-
// Logging
api "org.slf4j:slf4j-api:$slf4jVersion"
testImplementation "ch.qos.logback:logback-classic:$logbackVersion"
diff --git a/pgpainless-core/src/test/java/org/pgpainless/key/OpenPgpV5FingerprintTest.java b/pgpainless-core/src/test/java/org/pgpainless/key/OpenPgpV5FingerprintTest.java
index a250bef..3d2fdff 100644
--- a/pgpainless-core/src/test/java/org/pgpainless/key/OpenPgpV5FingerprintTest.java
+++ b/pgpainless-core/src/test/java/org/pgpainless/key/OpenPgpV5FingerprintTest.java
@@ -8,8 +8,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
import org.bouncycastle.openpgp.PGPKeyRing;
import org.bouncycastle.openpgp.PGPPublicKey;
@@ -100,80 +98,4 @@ public class OpenPgpV5FingerprintTest {
assertEquals(0, parsed.compareTo(parsed2));
}
- @Test
- public void constructFromMockedPublicKey() {
- String hex = "76543210ABCDEFAB01AB23CD1C0FFEE11EEFF0C1DC32BA10BAFEDCBA01234567";
- PGPPublicKey publicKey = getMockedPublicKey(hex);
-
- OpenPgpFingerprint fingerprint = OpenPgpFingerprint.of(publicKey);
- assertTrue(fingerprint instanceof OpenPgpV5Fingerprint);
- assertEquals(5, fingerprint.getVersion());
- assertEquals(hex, fingerprint.toString());
- }
-
- @Test
- public void constructFromMockedSecretKey() {
- String hex = "76543210ABCDEFAB01AB23CD1C0FFEE11EEFF0C1DC32BA10BAFEDCBA01234567";
- PGPPublicKey publicKey = getMockedPublicKey(hex);
- PGPSecretKey secretKey = mock(PGPSecretKey.class);
- when(secretKey.getPublicKey()).thenReturn(publicKey);
-
- OpenPgpFingerprint fingerprint = new OpenPgpV5Fingerprint(secretKey);
- assertEquals(5, fingerprint.getVersion());
- assertEquals(hex, fingerprint.toString());
- }
-
- @Test
- public void constructFromMockedPublicKeyRing() {
- String hex = "76543210ABCDEFAB01AB23CD1C0FFEE11EEFF0C1DC32BA10BAFEDCBA01234567";
- PGPPublicKey publicKey = getMockedPublicKey(hex);
- PGPPublicKeyRing publicKeys = mock(PGPPublicKeyRing.class);
- when(publicKeys.getPublicKey()).thenReturn(publicKey);
-
- OpenPgpFingerprint fingerprint = OpenPgpFingerprint.of(publicKeys);
- assertEquals(5, fingerprint.getVersion());
- assertEquals(hex, fingerprint.toString());
-
- fingerprint = new OpenPgpV5Fingerprint(publicKeys);
- assertEquals(hex, fingerprint.toString());
- }
-
- @Test
- public void constructFromMockedSecretKeyRing() {
- String hex = "76543210ABCDEFAB01AB23CD1C0FFEE11EEFF0C1DC32BA10BAFEDCBA01234567";
- PGPPublicKey publicKey = getMockedPublicKey(hex);
- PGPSecretKeyRing secretKeys = mock(PGPSecretKeyRing.class);
- when(secretKeys.getPublicKey()).thenReturn(publicKey);
-
- OpenPgpFingerprint fingerprint = OpenPgpFingerprint.of(secretKeys);
- assertEquals(5, fingerprint.getVersion());
- assertEquals(hex, fingerprint.toString());
-
- fingerprint = new OpenPgpV5Fingerprint(secretKeys);
- assertEquals(hex, fingerprint.toString());
- }
-
- @Test
- public void constructFromMockedKeyRing() {
- String hex = "76543210ABCDEFAB01AB23CD1C0FFEE11EEFF0C1DC32BA10BAFEDCBA01234567";
- PGPPublicKey publicKey = getMockedPublicKey(hex);
- PGPKeyRing keys = mock(PGPKeyRing.class);
- when(keys.getPublicKey()).thenReturn(publicKey);
-
- OpenPgpFingerprint fingerprint = OpenPgpFingerprint.of(keys);
- assertEquals(5, fingerprint.getVersion());
- assertEquals(hex, fingerprint.toString());
-
- fingerprint = new OpenPgpV5Fingerprint(keys);
- assertEquals(hex, fingerprint.toString());
- }
-
- private PGPPublicKey getMockedPublicKey(String hex) {
- byte[] binary = Hex.decode(hex);
-
- PGPPublicKey mocked = mock(PGPPublicKey.class);
- when(mocked.getVersion()).thenReturn(5);
- when(mocked.getFingerprint()).thenReturn(binary);
- return mocked;
- }
}
|