alexruiz/fest-assert-2.x — pull request #77 by olim7t (2012-07-21 19:15:49+00:00)
Title: Github#43 - new File assertions: hasBinaryContent(byte[]), usingCharset(Charset), hasContent(String)

The binary assertion reports the first different byte (offset, expected and actual).
The text assertion delegates to the existing `Diff` class (therefore reporting all different lines).

Notes:
* the new error class `ShouldHaveContent` is very similar to `ShouldHaveEqualContent` (I've made a method of the latter package-private to reuse it), but somehow it didn't feel right to use the same class for everything.
* the existing `FileAssert.hasContentEqualTo(File)` should probably use a charset too, at least to display lines correctly when reporting an error.
* `Diff` used `reader.ready()` to test if there were more lines. According to the Javadoc, the method returns "True if the next read() is guaranteed not to block for input, false otherwise". This seems to work with files, but not with `StringReader`. This has led me to refactor `Diff.diff` to use the test `readLine() != null`. I've also switched to using `BufferedReader`s and maintaining the line number in the code, because the reader is now past the line by the time we report an error.