### Question:
CertificateController implements Constants { @RequestMapping(path = "/v1/certificates/expirybyapplication", method = RequestMethod.GET) public ResponseEntity<Object> getCerticatesExpiryByApplication( @RequestParam(name = "ag", required = true) String assetGroup) throws ServiceException { if (Strings.isNullOrEmpty(assetGroup)) { return ResponseUtils.buildFailureResponse(new ServiceException( ASSET_MANDATORY)); } DitributionDTO response; try { response = new DitributionDTO( certificateService .getCerticatesExpiryByApplication(assetGroup)); } catch (ServiceException e) { LOGGER.error(EXE_CERT_EXPIRY,e); return ResponseUtils.buildFailureResponse(e); } return ResponseUtils.buildSucessResponse(response); }  @RequestMapping(path = "/v1/certificates/expirybyapplication", method = RequestMethod.GET) ResponseEntity<Object> getCerticatesExpiryByApplication(
            @RequestParam(name = "ag", required = true) String assetGroup); @RequestMapping(path = "/v1/certificates/detail", method = RequestMethod.POST) ResponseEntity<Object> getCertificatesDetails(
            @RequestBody(required = true) Request request); @RequestMapping(path = "/v1/certificates/summary", method = RequestMethod.GET) ResponseEntity<Object> getCertificatesSummary(
            @RequestParam(name = "ag", required = true) String assetGroup);  }### Answer:
@Test public void getCerticatesExpiryByApplicationTest() throws Exception { when(certificateService.getCerticatesExpiryByApplication(anyString())).thenReturn(new HashMap<>()); ResponseEntity<Object> responseObj = certificateController.getCerticatesExpiryByApplication("ag"); assertTrue(responseObj.getStatusCode() == HttpStatus.OK); }
@Test public void getCerticatesExpiryByApplicationTest_NoAg() throws Exception { ResponseEntity<Object> responseObj = certificateController.getCerticatesExpiryByApplication(""); assertTrue(responseObj.getStatusCode() == HttpStatus.EXPECTATION_FAILED); }
@Test public void getCerticatesExpiryByApplicationTest_Exception() throws Exception { when(certificateService.getCerticatesExpiryByApplication(anyString())).thenThrow(new ServiceException()); ResponseEntity<Object> responseObj = certificateController.getCerticatesExpiryByApplication("ag"); assertTrue(responseObj.getStatusCode() == HttpStatus.EXPECTATION_FAILED); }