Search in sources :

Example 1 with Identifier

use of org.shredzone.acme4j.Identifier in project acme4j by shred.

the class EmailProcessorTest method testEmailParser.

@Test
public void testEmailParser() throws MessagingException {
    EmailProcessor processor = new EmailProcessor(message);
    processor.expectedFrom(expectedFrom);
    processor.expectedTo(expectedTo);
    processor.expectedIdentifier(EmailIdentifier.email(expectedTo));
    processor.expectedIdentifier(new Identifier("email", expectedTo.getAddress()));
    assertThat(processor.getSender()).isEqualTo(expectedFrom);
    assertThat(processor.getRecipient()).isEqualTo(expectedTo);
    assertThat(processor.getMessageId()).isEqualTo(Optional.of("<A2299BB.FF7788@example.org>"));
    assertThat(processor.getToken1()).isEqualTo(TOKEN_PART1);
    assertThat(processor.getReplyTo()).contains(email("acme-validator@example.org"));
}
Also used : EmailIdentifier(org.shredzone.acme4j.smime.EmailIdentifier) Identifier(org.shredzone.acme4j.Identifier) Test(org.junit.jupiter.api.Test)

Example 2 with Identifier

use of org.shredzone.acme4j.Identifier in project acme4j by shred.

the class CSRBuilderTest method testUnknownType.

/**
 * Make sure an exception is thrown when an unknown identifier type is used.
 */
@Test
public void testUnknownType() {
    IllegalArgumentException iae = assertThrows(IllegalArgumentException.class, () -> {
        CSRBuilder builder = new CSRBuilder();
        builder.addIdentifier(new Identifier("UnKnOwN", "123"));
    });
    assertThat(iae.getMessage()).isEqualTo("Unknown identifier type: UnKnOwN");
}
Also used : Identifier(org.shredzone.acme4j.Identifier) ASN1ObjectIdentifier(org.bouncycastle.asn1.ASN1ObjectIdentifier) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)2 Identifier (org.shredzone.acme4j.Identifier)2 ASN1ObjectIdentifier (org.bouncycastle.asn1.ASN1ObjectIdentifier)1 EmailIdentifier (org.shredzone.acme4j.smime.EmailIdentifier)1