private static void checkTestingDirs() { assertThat(BASE_TESTING_DIR).exists().isDirectory(); assertThat(INPUT_DIR).exists().isDirectory(); assertThat(BATCH_RESIZE_OUTPUT_DIR).exists().isDirectory(); assertThat(BATCH_FILTER_OUTPUT_DIR).exists().isDirectory(); assertThat(Files.fileNamesIn(BATCH_RESIZE_OUTPUT_DIR.getPath(), false)).isEmpty(); assertThat(Files.fileNamesIn(BATCH_FILTER_OUTPUT_DIR.getPath(), false)).isEmpty(); }
/** * Loads the text content of a file, so that it can be passed to {@link #assertThat(String)}. * * <p>Note that this will load the entire file in memory; for larger files, there might be a more * efficient alternative with {@link #assertThat(File)}. * * @param file the file. * @param charsetName the name of the character set to use. * @return the content of the file. * @throws IllegalArgumentException if the given character set is not supported on this platform. * @throws FilesException if an I/O exception occurs. */ public static String contentOf(File file, String charsetName) { return Files.contentOf(file, charsetName); }
/** * Loads the text content of a file with the default character set, so that it can be passed to * {@link #assertThat(String)}. * * <p>Note that this will load the entire file in memory; for larger files, there might be a more * efficient alternative with {@link #assertThat(File)}. * * @param file the file. * @return the content of the file. * @throws FilesException if an I/O exception occurs. */ public static String contentOf(File file) { return Files.contentOf(file, Charset.defaultCharset()); }
/** * Loads the text content of a file, so that it can be passed to {@link #assertThat(String)}. * * <p>Note that this will load the entire file in memory; for larger files, there might be a more * efficient alternative with {@link #assertThat(File)}. * * @param file the file. * @param charset the character set to use. * @return the content of the file. * @throws NullPointerException if the given charset is {@code null}. * @throws FilesException if an I/O exception occurs. */ public static String contentOf(File file, Charset charset) { return Files.contentOf(file, charset); }