@Test
public void generateSSLCertificate_Failure() throws Exception {

    String jsonStr = "{  \"username\": \"testusername1\",  \"password\": \"testpassword1\"}";
    CertManagerLoginRequest certManagerLoginRequest = getCertManagerLoginRequest();
    certManagerLoginRequest.setUsername("username");
    certManagerLoginRequest.setPassword("password");
    SSLCertificateRequest sslCertificateRequest = getSSLCertificateRequest();
    sslCertificateRequest.setCertificateName("certificatename");
    String[] dnsNames = { };
    sslCertificateRequest.setDnsList(dnsNames);
    Map<String, Object> requestMap = new HashMap<>();
    requestMap.put("access_token", "12345");
    requestMap.put("token_type", "type");
    when(ControllerUtil.parseJson(jsonStr)).thenReturn(requestMap);
    CertManagerLogin certManagerLogin = new CertManagerLogin();
    certManagerLogin.setToken_type("token type");
    certManagerLogin.setAccess_token("1234");
    CertResponse response = new CertResponse();
    response.setHttpstatus(HttpStatus.INTERNAL_SERVER_ERROR);
    response.setResponse(jsonStr);
    response.setSuccess(true);
   doThrow(new TVaultValidationException("Exception while creating certificate"))
            .when(reqProcessor).processCert(anyString(), anyObject(), anyString(), anyString());
    ResponseEntity<?> enrollResponse = sSLCertificateService.generateSSLCertificate(sslCertificateRequest,
            userDetails,token);
    //Assert
    assertNotNull(enrollResponse);
    assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, enrollResponse.getStatusCode());
}