@Test
public void test_downloadCertificateWithPrivateKey() throws Exception {

    CertificateDownloadRequest certificateDownloadRequest = new CertificateDownloadRequest(
            "abc.com", "password", "pembundle", false,"internal");
    String inputJson =new ObjectMapper().writeValueAsString(certificateDownloadRequest);
    InputStreamResource resource = null;
    ResponseEntity<InputStreamResource> responseEntityExpected = ResponseEntity.status(HttpStatus.OK).body(resource);
    UserDetails userDetails = getMockUser(true);
    when(sslCertificateService.downloadCertificateWithPrivateKey(eq("5PDrOhsy4ig8L3EpsJZSLAMg"), Mockito.any(), eq(userDetails))).thenReturn(responseEntityExpected);
    mockMvc.perform(MockMvcRequestBuilders.post("/v2/sslcert/certificates/download").requestAttr("UserDetails", userDetails)
            .header("vault-token", "5PDrOhsy4ig8L3EpsJZSLAMg")
            .header("Content-Type", "application/json;charset=UTF-8")
            .content(inputJson))
            .andExpect(status().isOk());
}