aboutsummaryrefslogtreecommitdiff
path: root/src/test/model/pki/crl/CertificateListContentTest.java
blob: ec18629da4597dc001806b2287dbbe422f3f0951 (plain)
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
package model.pki.crl;

import model.TestConstants;
import model.asn1.*;
import model.asn1.exceptions.ParseException;
import model.pki.AlgorithmIdentifier;
import model.x501.AttributeTypeAndValue;
import model.x501.Name;
import model.x501.RelativeDistinguishedName;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import java.time.ZoneId;
import java.time.ZonedDateTime;

import static model.TestConstants.*;
import static org.junit.jupiter.api.Assertions.*;

public class CertificateListContentTest {
    @Test
    void testConstructor() {
        assertEquals(1, CRL_CONTENT_1.getVersion().getLong());
        assertEquals("CN=Test CA", CRL_CONTENT_1.getIssuer().toString());
        assertArrayEquals(ObjectIdentifier.OID_SHA256_WITH_RSA_ENCRYPTION,
                CRL_CONTENT_1.getSignature().getType().getInts());
        assertEquals(GeneralizedTime.TAG.getNumber(),
                CRL_CONTENT_1.getThisUpdate().getTag().getNumber());
        assertNull(CRL_CONTENT_1.getNextUpdate());
        assertEquals(2, CRL_CONTENT_1.getRevokedCertificates().length);
    }

    @Test
    void testEncode() {
        assertArrayEquals(CRL_CONTENT_1_DER, CRL_CONTENT_1.encodeDER());
        assertArrayEquals(CRL_CONTENT_2_DER, CRL_CONTENT_2.encodeDER());
    }
}