aboutsummaryrefslogtreecommitdiffstats
path: root/libraries/spongycastle/core/src/test/java/org/spongycastle/asn1/test/DeclarationOfMajorityUnitTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/spongycastle/core/src/test/java/org/spongycastle/asn1/test/DeclarationOfMajorityUnitTest.java')
-rw-r--r--libraries/spongycastle/core/src/test/java/org/spongycastle/asn1/test/DeclarationOfMajorityUnitTest.java91
1 files changed, 0 insertions, 91 deletions
diff --git a/libraries/spongycastle/core/src/test/java/org/spongycastle/asn1/test/DeclarationOfMajorityUnitTest.java b/libraries/spongycastle/core/src/test/java/org/spongycastle/asn1/test/DeclarationOfMajorityUnitTest.java
deleted file mode 100644
index 2454b1fd8..000000000
--- a/libraries/spongycastle/core/src/test/java/org/spongycastle/asn1/test/DeclarationOfMajorityUnitTest.java
+++ /dev/null
@@ -1,91 +0,0 @@
-package org.spongycastle.asn1.test;
-
-import java.io.IOException;
-
-import org.spongycastle.asn1.ASN1GeneralizedTime;
-import org.spongycastle.asn1.ASN1InputStream;
-import org.spongycastle.asn1.DERGeneralizedTime;
-import org.spongycastle.asn1.DERTaggedObject;
-import org.spongycastle.asn1.isismtt.x509.DeclarationOfMajority;
-
-public class DeclarationOfMajorityUnitTest
- extends ASN1UnitTest
-{
- public String getName()
- {
- return "DeclarationOfMajority";
- }
-
- public void performTest()
- throws Exception
- {
- ASN1GeneralizedTime dateOfBirth = new ASN1GeneralizedTime("20070315173729Z");
- DeclarationOfMajority decl = new DeclarationOfMajority(dateOfBirth);
-
- checkConstruction(decl, DeclarationOfMajority.dateOfBirth, dateOfBirth, -1);
-
- decl = new DeclarationOfMajority(6);
-
- checkConstruction(decl, DeclarationOfMajority.notYoungerThan, null, 6);
-
- decl = DeclarationOfMajority.getInstance(null);
-
- if (decl != null)
- {
- fail("null getInstance() failed.");
- }
-
- try
- {
- DeclarationOfMajority.getInstance(new Object());
-
- fail("getInstance() failed to detect bad object.");
- }
- catch (IllegalArgumentException e)
- {
- // expected
- }
- }
-
- private void checkConstruction(
- DeclarationOfMajority decl,
- int type,
- DERGeneralizedTime dateOfBirth,
- int notYoungerThan)
- throws IOException
- {
- checkValues(decl, type, dateOfBirth, notYoungerThan);
-
- decl = DeclarationOfMajority.getInstance(decl);
-
- checkValues(decl, type, dateOfBirth, notYoungerThan);
-
- ASN1InputStream aIn = new ASN1InputStream(decl.toASN1Object().getEncoded());
-
- DERTaggedObject info = (DERTaggedObject)aIn.readObject();
-
- decl = DeclarationOfMajority.getInstance(info);
-
- checkValues(decl, type, dateOfBirth, notYoungerThan);
- }
-
- private void checkValues(
- DeclarationOfMajority decl,
- int type,
- DERGeneralizedTime dateOfBirth,
- int notYoungerThan)
- {
- checkMandatoryField("type", type, decl.getType());
- checkOptionalField("dateOfBirth", dateOfBirth, decl.getDateOfBirth());
- if (notYoungerThan != -1 && notYoungerThan != decl.notYoungerThan())
- {
- fail("notYoungerThan mismatch");
- }
- }
-
- public static void main(
- String[] args)
- {
- runTest(new DeclarationOfMajorityUnitTest());
- }
-}