### Question:
AcmFilesystemMailTemplateConfigurationService implements AcmMailTemplateConfigurationService { @Override public List<EmailTemplateConfiguration> getTemplateConfigurations() throws AcmEmailConfigurationException { Lock readLock = lock.readLock(); readLock.lock(); try (InputStream is = templateConfigurations.getInputStream()) { List<EmailTemplateConfiguration> readConfigurationList = getObjectConverter().getJsonUnmarshaller() .unmarshallCollection(IOUtils.toString(is, StandardCharsets.UTF_8), List.class, EmailTemplateConfiguration.class); if (readConfigurationList == null) { log.warn("Error while deserializing email templates configuration from {} file.", templateConfigurations.getDescription(), null); throw new AcmEmailConfigurationJsonException( String.format("Error while deserializing email templates configuration from %s file.", templateConfigurations.getDescription()), null); } return readConfigurationList; } catch (IOException e) { log.warn("Error while reading email templates configuration from {} file.", templateConfigurations.getDescription(), e); throw new AcmEmailConfigurationIOException(String.format("Error while reading email templates configuration from %s file.", templateConfigurations.getDescription()), e); } finally { readLock.unlock(); } }  @Override List<EmailTemplateConfiguration> getTemplateConfigurations(); void setTemplateConfigurations(Resource templateConfigurations); @Override EmailTemplateValidationResponse validateEmailTemplate(EmailTemplateConfiguration templateData); @Override void updateEmailTemplate(EmailTemplateConfiguration templateData, MultipartFile template); @Override List<EmailTemplateConfiguration> getMatchingTemplates(String email, String objectType, EmailSource source, List<String> actions); @Override String getTemplate(String templateName); @Override void deleteTemplate(String templateName); @Override AcmEmailServiceExceptionMapper<ME> getExceptionMapper(AcmEmailServiceException e); void setTemplateFolderPath(String templateFolderPath); ObjectConverter getObjectConverter(); void setObjectConverter(ObjectConverter objectConverter);  }### Answer:
@Test public void testGetTemplateConfigurations() throws Exception { String fileName = getClass().getClassLoader().getResource("mailTemplatesConfiguration.json").getFile(); when(templateConfigurations.getInputStream()).thenReturn(new FileInputStream(fileName)); List<EmailTemplateConfiguration> configurations = service.getTemplateConfigurations(); assertThat(configurations.size(), is(1)); EmailTemplateConfiguration configuration = configurations.get(0); assertThat(configuration.getEmailPattern(), is(EMAIL_PATTERN)); assertThat(configuration.getSource(), is(EmailSource.MANUAL)); assertThat(configuration.getTemplateName(), is(TEMPLATE_NAME)); assertThat(configuration.getObjectTypes().size(), is(2)); assertThat(configuration.getObjectTypes().contains(CASE_FILE), is(true)); assertThat(configuration.getObjectTypes().contains(COMPLAINT), is(true)); assertThat(configuration.getActions().size(), is(2)); assertThat(configuration.getActions().contains(SEND_AS_ATTACHMENTS), is(true)); assertThat(configuration.getActions().contains(SEND_AS_LINKS), is(true)); }
@Test public void testGetTemplateConfigurations_InputStreamException() throws Exception { IOException ioException = new IOException(); when(templateConfigurations.getInputStream()).thenThrow(ioException); when(templateConfigurations.getDescription()).thenReturn(ABSOLUTE_PATH_TO_RESOURCE); exception.expect(AcmEmailConfigurationException.class); exception.expectMessage(is( String.format("Error while reading email templates configuration from %s file.", templateConfigurations.getDescription()))); exception.expectCause(is(ioException)); service.getTemplateConfigurations(); }