NCLMMockUtil { public CertificateData getMockCertificateData(SSLCertificateRequest sslCertificateRequest){ DateTimeFormatter formatter= DateTimeFormatter.ofPattern("uuuu-MM-dd'T'HH:mm:ssXXX"); OffsetDateTime now = OffsetDateTime.now(ZoneId.of("-07:00")); String fromDate = now.format(formatter); int endYear = Integer.parseInt(fromDate.substring(0,4))+1; CertificateData certificateData = new CertificateData(); certificateData.setCertificateName(sslCertificateRequest.getCertificateName()); certificateData.setCertificateId(11); certificateData.setCertificateStatus("Active"); certificateData.setCreateDate(now.format(formatter)); certificateData.setExpiryDate(endYear +fromDate.substring(4)); certificateData.setContainerName("T-Vault-Test"); certificateData.setAuthority("T-Mobile Issuing CA 01 - SHA2"); certificateData.setDnsNames(Arrays.asList(sslCertificateRequest.getDnsList())); return certificateData; } NCLMMockUtil(); CertResponse getRevocationMockResponse(); CertificateData getRenewCertificateMockData(); CertResponse getRenewMockResponse(); CertResponse getDeleteMockResponse(); CertificateData getDeleteCertMockResponse(Map<String, String>  metaDataParams); CertManagerLogin getMockLoginDetails(); CertResponse getEnrollMockResponse(); CertificateData getMockCertificateData(SSLCertificateRequest sslCertificateRequest); CertResponse getMockRevocationReasons(); CertificateData getMockDataForRevoked();  }
@Test public void getMockCertificateData_Test() { SSLCertificateRequest sslCertificateRequest = new SSLCertificateRequest(); sslCertificateRequest.setCertificateName("test1"); sslCertificateRequest.setDnsList(new String[] { "A", "B", "C", "D" }); CertificateData certificateData = nclmMockUtil.getMockCertificateData(sslCertificateRequest); assertNotNull(certificateData); }