@Test public final void testReadFileShouldReturnNullWhenRequestedFileIsNotAFile() { given(path.resolve(FILE_NAME)).willReturn(messageFilePath); given(messageFilePath.toFile()).willReturn(messageFile); given(messageFile.isFile()).willReturn(false); given(messageFile.exists()).willReturn(false); InputStream actual = underTest.readFile(FILE_NAME, path); assertNull(actual); }
public InputStream readFile(final String filename, final Path filePath) { File requestedFile = getFile(filename, filePath); InputStream fileInputStream = null; if (requestedFile.isFile()) { if (requestedFile.exists()) { try { fileInputStream = fileInputStreamFactory.createFileInputStream(requestedFile); } catch (FileNotFoundException e) { logger.warn("Message file not found!", e); } } } return fileInputStream; }
FileReader { public InputStream readFile(final String filename, final Path filePath) { File requestedFile = getFile(filename, filePath); InputStream fileInputStream = null; if (requestedFile.isFile()) { if (requestedFile.exists()) { try { fileInputStream = fileInputStreamFactory.createFileInputStream(requestedFile); } catch (FileNotFoundException e) { logger.warn("Message file not found!", e); } } } return fileInputStream; } }
FileReader { public InputStream readFile(final String filename, final Path filePath) { File requestedFile = getFile(filename, filePath); InputStream fileInputStream = null; if (requestedFile.isFile()) { if (requestedFile.exists()) { try { fileInputStream = fileInputStreamFactory.createFileInputStream(requestedFile); } catch (FileNotFoundException e) { logger.warn("Message file not found!", e); } } } return fileInputStream; }  }
FileReader { public InputStream readFile(final String filename, final Path filePath) { File requestedFile = getFile(filename, filePath); InputStream fileInputStream = null; if (requestedFile.isFile()) { if (requestedFile.exists()) { try { fileInputStream = fileInputStreamFactory.createFileInputStream(requestedFile); } catch (FileNotFoundException e) { logger.warn("Message file not found!", e); } } } return fileInputStream; }  InputStream readFile(final String filename, final Path filePath); }
FileReader { public InputStream readFile(final String filename, final Path filePath) { File requestedFile = getFile(filename, filePath); InputStream fileInputStream = null; if (requestedFile.isFile()) { if (requestedFile.exists()) { try { fileInputStream = fileInputStreamFactory.createFileInputStream(requestedFile); } catch (FileNotFoundException e) { logger.warn("Message file not found!", e); } } } return fileInputStream; }  InputStream readFile(final String filename, final Path filePath);  }