### Question:
CertificateService { public Map<String, Object> getCerticatesSummary(String assetGroup) throws ServiceException { try{ return certificateRepository.getCertificatesSummary(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 getCerticatesSummaryTest() throws Exception { when(certificateRepository.getCertificatesSummary(anyString())).thenReturn(new HashMap<>()); assertThat(certificateService.getCerticatesSummary("ag"), is(notNullValue())); }
@Test public void getCerticatesSummaryTest_Exception() throws Exception { when(certificateRepository.getCertificatesSummary(anyString())).thenThrow(new DataException()); assertThatThrownBy(() ->certificateService.getCerticatesSummary("ag")) .isInstanceOf(ServiceException.class); }