@Test
public void getSelfSigned_generatesACertificateWithTheRightValues() throws Exception {

  final X509Certificate generatedCertificate = subject.getSelfSigned(generatedCertificateKeyPair, certificateGenerationParameters);
  assertThat(generatedCertificate.getIssuerDN().getName(), containsString("CN=my cert name"));
  assertThat(generatedCertificate.getSubjectDN().toString(), containsString("CN=my cert name"));
  generatedCertificate.verify(generatedCertificateKeyPair.getPublic());
  final byte[] authorityKeyIdDer = generatedCertificate.getExtensionValue(Extension.authorityKeyIdentifier.getId());
  final AuthorityKeyIdentifier authorityKeyIdentifier = AuthorityKeyIdentifier.getInstance(parseExtensionValue(authorityKeyIdDer));
  final byte[] authorityKeyId = authorityKeyIdentifier.getKeyIdentifier();
  expectedSubjectKeyIdentifier = jcaX509ExtensionUtils.createSubjectKeyIdentifier(generatedCertificateKeyPair.getPublic()).getKeyIdentifier();
  assertThat(authorityKeyId, equalTo(expectedSubjectKeyIdentifier));
  assertThat(generatedCertificate.getSerialNumber(), equalTo(BigInteger.valueOf(1337)));
}