@Test
public void findTransitionalVersion_givenExistingTransitionalCa_returnsTheTransitionalCa() {

  final CertificateReader certificateReader = mock(CertificateReader.class);
  when(transitionalCertificateCredential.getParsedCertificate()).thenReturn(certificateReader);
  when(certificateReader.isCa()).thenReturn(true);
  when(certificateVersionDataService.findBothActiveCertAndTransitionalCert(CREDENTIAL_NAME)).thenReturn(Arrays.asList(certificateCredential, transitionalCertificateCredential));
  when(transitionalCertificateCredential.getCertificate()).thenReturn(SELF_SIGNED_CA_CERT);
  assertThat(certificateAuthorityService.findTransitionalVersion(CREDENTIAL_NAME).getCertificate(),
    equalTo(transitionalCertificateCredential.getCertificate()));
}