@Test public void testEnsureDirectoryExistsWithError() { Path impossible = existingFile.resolve("file"); assertThrows(VocabHunterException.class, () -> FileTool.ensureDirectoryExists(impossible, ERROR_TEMPLATE)); }
public static void ensureDirectoryExists(final Path file, final String errorTemplate) { Path parent = file.getParent(); try { if (parent != null) { Files.createDirectories(parent); } } catch (final IOException e) { throw buildError(parent, errorTemplate, e); } }
FileTool { public static void ensureDirectoryExists(final Path file, final String errorTemplate) { Path parent = file.getParent(); try { if (parent != null) { Files.createDirectories(parent); } } catch (final IOException e) { throw buildError(parent, errorTemplate, e); } } }
FileTool { public static void ensureDirectoryExists(final Path file, final String errorTemplate) { Path parent = file.getParent(); try { if (parent != null) { Files.createDirectories(parent); } } catch (final IOException e) { throw buildError(parent, errorTemplate, e); } } private  FileTool(); }
FileTool { public static void ensureDirectoryExists(final Path file, final String errorTemplate) { Path parent = file.getParent(); try { if (parent != null) { Files.createDirectories(parent); } } catch (final IOException e) { throw buildError(parent, errorTemplate, e); } } private  FileTool(); static void ensureDirectoryExists(final Path file, final String errorTemplate); static void writeMinimalJson(final Path file, final String errorTemplate); static void writeAsJson(final Path file, final Object v, final String errorTemplate); static T readFromJson(final Class<T> beanClass, final Path file, final String errorTemplate); }
FileTool { public static void ensureDirectoryExists(final Path file, final String errorTemplate) { Path parent = file.getParent(); try { if (parent != null) { Files.createDirectories(parent); } } catch (final IOException e) { throw buildError(parent, errorTemplate, e); } } private  FileTool(); static void ensureDirectoryExists(final Path file, final String errorTemplate); static void writeMinimalJson(final Path file, final String errorTemplate); static void writeAsJson(final Path file, final Object v, final String errorTemplate); static T readFromJson(final Class<T> beanClass, final Path file, final String errorTemplate);  }