### Question:
KycController { @RequestMapping(value = "/kyc/{investorId}/status", method = GET, produces = APPLICATION_JSON_UTF8_VALUE) public ResponseEntity<KycInfo> getKycStatus(@PathVariable("investorId") Long investorId, @Context HttpServletRequest requestContext) throws NonexistentInvestorException { String ipAddress = IPAddressUtil.getIPAddress(requestContext); LOG.info("/status called from {} with investorId {}", ipAddress, investorId); try { KycInfo kycInfo = kycInfoService.getKycInfoByInvestorId(investorId); return ResponseEntity .status(HttpStatus.OK) .body(kycInfo); } catch(InvestorNotFoundException e) { throw new NonexistentInvestorException(); } }  @RequestMapping(value = "/kyc/start", method = POST, produces = APPLICATION_JSON_UTF8_VALUE) ResponseEntity<StartAllKycResponseDTO> startKyc(@Context HttpServletRequest requestContext); @RequestMapping(value = "/kyc/{investorId}/start", method = POST, consumes = APPLICATION_JSON_UTF8_VALUE, produces = APPLICATION_JSON_UTF8_VALUE) ResponseEntity<StartSingleKycResponseDTO> startKycForInvestor(@PathVariable("investorId") Long investorId,
                                                                         @RequestBody(required = false) KycStartRequestDTO kycStartRequest,
                                                                         @Context HttpServletRequest requestContext); @RequestMapping(value = "/kyc/{investorId}/remind", method = POST, produces = APPLICATION_JSON_UTF8_VALUE) ResponseEntity<RemindSingleKycResponseDTO> remindInvestor(@PathVariable("investorId") Long investorId,
                                            @Context HttpServletRequest requestContext); @RequestMapping(value = "/kyc/{investorId}/complete", method = POST, produces = APPLICATION_JSON_UTF8_VALUE) ResponseEntity<CompleteSingleKycResponseDTO> setInvestorComplete(@PathVariable("investorId") Long investorId,
                                                 @Context HttpServletRequest requestContext); @RequestMapping(value = "/kyc/{investorId}/status", method = GET, produces = APPLICATION_JSON_UTF8_VALUE) ResponseEntity<KycInfo> getKycStatus(@PathVariable("investorId") Long investorId,
                                          @Context HttpServletRequest requestContext); @RequestMapping(value = "/kyc/fetchall", method = GET, produces = APPLICATION_JSON_UTF8_VALUE) ResponseEntity<FetchAllResponseDTO> fetchAllKycIdentifications(@Context HttpServletRequest requestContext);  }### Answer:
@Test public void testGetKycStatus() throws Exception { KycInfo kycInfo = createKycInfo(true, 0,true); when(mockKycInfoService.getKycInfoByInvestorId(INVESTOR_ID)).thenReturn(kycInfo); MvcResult result1 = mockMvc.perform(MockMvcRequestBuilders.get(KYC_INVESTOR_STATUS) .contentType(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()) .andDo(print()) .andReturn(); KycInfo actual = mapper.readValue(result1.getResponse().getContentAsString(), KycInfo.class); assertThat(kycInfo.equals(actual)); when(mockKycInfoService.getKycInfoByInvestorId(INVESTOR_ID)).thenThrow(new InvestorNotFoundException()); MvcResult result2 = mockMvc.perform(MockMvcRequestBuilders.get(KYC_INVESTOR_STATUS) .contentType(MediaType.APPLICATION_JSON)) .andExpect(status().isBadRequest()) .andDo(print()) .andReturn(); assertThat(result2.getResponse().getErrorMessage()).isEqualTo(NONEXISTENT_INVESTOR_REASON); }