public void assertHasSameContentAs(AssertionInfo info, Path actual, Charset actualCharset, Path expected, Charset expectedCharset) { checkNotNull(expected, "The given Path to compare actual content to should not be null"); checkArgument(nioFilesWrapper.isReadable(expected), "The given Path <%s> to compare actual content to should be readable", expected); assertIsReadable(info, actual); try { List<Delta<String>> diffs = diff.diff(actual, actualCharset, expected, expectedCharset); if (diffs.isEmpty()) return; throw failures.failure(info, shouldHaveSameContent(actual, expected, diffs)); } catch (IOException e) { throw new UncheckedIOException(format("Unable to compare contents of paths:<%s> and:<%s>", actual, expected), e); } }
public void assertIsReadable(final AssertionInfo info, final Path actual) { assertNotNull(info, actual); assertExists(info, actual); if (!nioFilesWrapper.isReadable(actual)) throw failures.failure(info, shouldBeReadable(actual)); }
public void assertHasSameContentAs(AssertionInfo info, Path actual, Charset actualCharset, Path expected, Charset expectedCharset) { checkNotNull(expected, "The given Path to compare actual content to should not be null"); checkArgument(nioFilesWrapper.isReadable(expected), "The given Path <%s> to compare actual content to should be readable", expected); assertIsReadable(info, actual); try { List<Delta<String>> diffs = diff.diff(actual, actualCharset, expected, expectedCharset); if (diffs.isEmpty()) return; throw failures.failure(info, shouldHaveSameContent(actual, expected, diffs)); } catch (IOException e) { throw new UncheckedIOException(format("Unable to compare contents of paths:<%s> and:<%s>", actual, expected), e); } }
public void assertIsReadable(final AssertionInfo info, final Path actual) { assertNotNull(info, actual); assertExists(info, actual); if (!nioFilesWrapper.isReadable(actual)) throw failures.failure(info, shouldBeReadable(actual)); }