@Test
    public void testGenerateCertificateSubject() throws Exception
    {
        // Setup fixture.
        final KeyPair keyPair = subjectKeyPair;
        final int days = 2;
        final String issuerCommonName = "issuer common name";
        final String subjectCommonName = "subject common name";
        final String domain = "domain.example.org";
        final Set<String> sanDnsNames = Stream.of( "alternative-a.example.org", "alternative-b.example.org" ).collect( Collectors.toSet() );

        // Execute system under test.
        final X509Certificate result = CertificateManager.createX509V3Certificate( keyPair, days, issuerCommonName, subjectCommonName, domain, SIGNATURE_ALGORITHM, sanDnsNames );

        // Verify results.
        assertNotNull( result );

        final Set<String> foundSubjectCNs = parse( result.getSubjectX500Principal().getName(), "CN" );
        assertEquals( 1, foundSubjectCNs.size() );
        assertEquals( subjectCommonName, foundSubjectCNs.iterator().next() );
    }
Asserts that the provided common name of the subject is returned as part of the subject distinguished name in a certificate that is generated by {@link org.jivesoftware.util.CertificateManager#createX509V3Certificate(KeyPair, int, X500NameBuilder, X500NameBuilder, String, String, Set)}
xmppserver/src/test/java/org/jivesoftware/util/CertificateManagerTest.java