Use platform-specific line separators by albertdev · Pull Request #267 · hamcrest/JavaHamcrest
I noticed that when I log an assertion error created by Hamcrest that it uses a single line feed character (Unix style end-of-line). Since the rest of my log uses carriage return / line feed pairs (Windows style end-of-line) this will confuse some editors like Vim or Eclipse which generally expect a file to use the same style throughout.
Rather than hardcoding one or the other, the System.lineSeparator() function will return the end of line separator appropriate for the current runtime, i.e. "\r\n" on Windows and "\n" on Unix. This way it will adapt to the Java runtime's platform. And should for some reason a user prefer the other style, they should be able to set the line.separator property at startup.