Utilities { public static byte[] readFileContent(final String filePath) throws APIRestGeneratorException { Path path = null ; if (filePath.toLowerCase().startsWith(ConstantsInput.SO_PATH_STRING_PREFIX)) { path = Paths.get(URI.create(filePath)) ; } else { path = Paths.get(filePath, new String[0]) ; } byte[] fileContent = null ; if (Files.exists(path, new LinkOption[0])) { try { fileContent = FileUtils.readFileToByteArray(path.toFile()) ; } catch (IOException ioException) { final String errorString = "IOException when reading the file '" + filePath + "': " + ioException ; Utilities.LOGGER.error(errorString, ioException) ; throw new APIRestGeneratorException(errorString, ioException) ; } } return fileContent ; } private  Utilities(); static String generateTemporaryOutputDirectory(final String generatorBuilderPath); static byte[] readFileContent(final String filePath);  }
@Test public void fullTest() throws APIRestGeneratorException { Utilities.readFileContent(ConstantsTest.SRC_TEST_RESOURCES_PATH + File.separator + ConstantsTest.ANT_FILE) ; }
@Test public void invalidFileReadContent() throws APIRestGeneratorException { Utilities.readFileContent(ConstantsInput.SO_PATH_STRING_PREFIX + "/tmp/invalidFile") ; }