### Question:
CertificateService { public Map<String, Object> getCerticatesExpiryByApplication( String assetGroup) throws ServiceException { try{return certificateRepository .getCertificatesExpiryByApplication(assetGroup); }catch(DataException e){ throw new ServiceException(e); } }  Map<String, Object> getCerticatesExpiryByApplication(
            String assetGroup); List<Map<String, Object>> getCerticatesDetails(String assetGroup,
            String searchText, Map<String, String> filter); Map<String, Object> getCerticatesSummary(String assetGroup);  }### Answer:
@Test public void getCerticatesExpiryByApplicationTest() throws Exception { when(certificateRepository.getCertificatesExpiryByApplication(anyString())).thenReturn(new HashMap<>()); assertThat(certificateService.getCerticatesExpiryByApplication("ag"), is(notNullValue())); }
@Test public void getCerticatesExpiryByApplicationTest_Exception() throws Exception { when(certificateRepository.getCertificatesExpiryByApplication(anyString())).thenThrow(new DataException()); assertThatThrownBy(() ->certificateService.getCerticatesExpiryByApplication("ag")) .isInstanceOf(ServiceException.class); }