### Question:
CertificateController { @ApiOperation(value = "Create a new base64 encoded X509 certificate for authentication at the " + "XS2A API with the corresponding private key and meta data", response = CertificateResponse.class) @PostMapping public ResponseEntity<CertificateResponse> createCert( @Valid @RequestBody CertificateRequest certData) { return ResponseEntity.status(HttpStatus.OK) .body(cerService.newCertificate(certData)); } CertificateController(CertificateService cerService); @ApiOperation(value = "Create a new base64 encoded X509 certificate for authentication at the " + "XS2A API with the corresponding private key and meta data", response = CertificateResponse.class) @PostMapping ResponseEntity<CertificateResponse> createCert(
      @Valid @RequestBody CertificateRequest certData);  }### Answer:
@Test public void createCert() throws Exception { CertificateResponse certificateResponse = CertificateResponse.builder() .encodedCert(CERTIFICATE) .privateKey(PRIVATE_KEY) .build(); given(certificateService.newCertificate(anyObject())).willReturn(certificateResponse); CertificateRequest certificateRequest = CertificateRequest.builder() .authorizationNumber("87B2AC") .commonName("XS2A Sandbox") .organizationName("Fictional Corporation AG") .roles(Collections.singletonList(PspRole.AISP)) .build(); mockMvc.perform( post("/api/cert-generator").contentType(MediaType.APPLICATION_JSON) .content(objectMapper.writeValueAsString(certificateRequest))) .andExpect(status().isOk()) .andExpect(jsonPath("$.encodedCert").value(CERTIFICATE)) .andExpect(jsonPath("$.privateKey").value(PRIVATE_KEY)); }