You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, newlines elsewhere in the expected value are not ignored. For example, this assertion fails: assertThat(Path.of("foo.txt")).hasContent("\nHello, world"); with the following error:
java.lang.AssertionError:
Path:
foo.txt
read with charset UTF-8 does not have the expected content:
Missing content at line 1:
[""]
Equally, multiple newlines are not ignored. For example, this assertion fails: assertThat(Path.of("foo.txt")).hasContent("Hello, world\n\n"); with the following error:
java.lang.AssertionError:
Path:
foo.txt
read with charset UTF-8 does not have the expected content:
Missing content at line 2:
[""]
Finally, a trailing newline is also ignored in the actual value. For example, given a file named foo.txt with the following contents:
The text was updated successfully, but these errors were encountered:
rupert-madden-abbott
changed the title
AbstractPathAssert.hasContent ignores trailing newlines
AbstractPathAssert.hasContent ignores a single trailing newline
Mar 21, 2023
Given a file named foo.txt with the following contents:
The following assertions pass:
However, newlines elsewhere in the expected value are not ignored. For example, this assertion fails:
assertThat(Path.of("foo.txt")).hasContent("\nHello, world");
with the following error:Equally, multiple newlines are not ignored. For example, this assertion fails:
assertThat(Path.of("foo.txt")).hasContent("Hello, world\n\n");
with the following error:Finally, a trailing newline is also ignored in the actual value. For example, given a file named foo.txt with the following contents:
The following assertions pass:
The text was updated successfully, but these errors were encountered: