mirror of
https://codeberg.org/PGPainless/sop-java.git
synced 2024-12-01 19:42:08 +01:00
Add tests for Verification parsing
This commit is contained in:
parent
7ea46a1916
commit
aa88904711
1 changed files with 19 additions and 1 deletions
|
@ -2,17 +2,19 @@
|
||||||
//
|
//
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
package sop.util;
|
package sop;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import sop.Verification;
|
import sop.Verification;
|
||||||
import sop.enums.SignatureMode;
|
import sop.enums.SignatureMode;
|
||||||
import sop.testsuite.assertions.VerificationAssert;
|
import sop.testsuite.assertions.VerificationAssert;
|
||||||
|
import sop.util.UTCUtil;
|
||||||
|
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||||
|
|
||||||
public class VerificationTest {
|
public class VerificationTest {
|
||||||
|
|
||||||
|
@ -89,4 +91,20 @@ public class VerificationTest {
|
||||||
.hasMode(null)
|
.hasMode(null)
|
||||||
.hasDescription("certificate from dkg.asc");
|
.hasDescription("certificate from dkg.asc");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void missingFingerprintFails() {
|
||||||
|
String string = "2022-11-07T15:01:24Z F9E6F53F7201C60A87064EAB0B27F2B0760A1209";
|
||||||
|
assertThrows(IllegalArgumentException.class, () -> Verification.fromString(string));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void malformedTimestampFails() {
|
||||||
|
String shorter = "'99-11-07T15:01:24Z F9E6F53F7201C60A87064EAB0B27F2B0760A1209 4E2C78519512C2AE9A8BFE7EB3298EB2FBE5F51B";
|
||||||
|
assertThrows(IllegalArgumentException.class, () -> Verification.fromString(shorter));
|
||||||
|
|
||||||
|
String longer = "'99-11-07T15:01:24Z F9E6F53F7201C60A87064EAB0B27F2B0760A1209 4E2C78519512C2AE9A8BFE7EB3298EB2FBE5F51B mode:binary certificate from dkg.asc";
|
||||||
|
assertThrows(IllegalArgumentException.class, () -> Verification.fromString(longer));
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue