### Question:
CertificateService { public CertificateResponse newCertificate(CertificateRequest certificateRequest) { SubjectData subjectData = generateSubjectData(certificateRequest); QCStatement qcStatement = generateQcStatement(certificateRequest); X509Certificate cert = generateCertificate(subjectData, issuerData, qcStatement); try { String formattedCertificate = format(cert); log.debug(formattedCertificate); } catch (Exception ex) { throw new CertificateException("Could not format certificate", ex); } return CertificateResponse.builder() .privateKey(exportToString(subjectData.getPrivateKey())) .encodedCert(exportToString(cert)) .build(); } CertificateService(); CertificateResponse newCertificate(CertificateRequest certificateRequest);  }### Answer:
@Test public void newCertificateCreatesCertAndKey() { CertificateService certificateService = new CertificateService(); CertificateRequest certificateRequest = CertificateRequest.builder() .authorizationNumber("12345") .countryName("Germany") .organizationName("adorsys") .commonName("XS2A Sandbox") .build(); CertificateResponse certificateResponse = certificateService.newCertificate(certificateRequest); assertNotNull(certificateResponse.getPrivateKey()); assertNotNull(certificateResponse.getEncodedCert()); }