This can happen when core.autocrlf is set to false in the git config.
The file containing an expected string is then not converted to crlf and
since the generated string in the test contains crlf, the comparison
fails.
To make tests consistent everywhere, I suggest to disable the autocrlf
of git directly in the Git repository using .gitattributes, see
http://git-scm.com/docs/gitattributes
And to fix the test on Windows, we can always convert the generated
String to lf line endings.
Change-Id: Ife8912ace7895ebca4d19adb53c6ba169ca2d003
Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/63080
Reviewed-by: Hudson CI
Reviewed-by: Patrick Tasse <patrick.tasse@gmail.com>
Tested-by: Patrick Tasse <patrick.tasse@gmail.com>
--- /dev/null
+* -text
\ No newline at end of file
AbstractRemoteImportProfilesIOTest {
private static final String ENCODING = "UTF-8"; //$NON-NLS-1$
+ private static final String LINE_SEPARATOR_PROPERTY = "line.separator";
/**
* Test writing a profiles file.
File expectedFile = getProfilesFile(VALID_PROFILE_PATH);
String expectedContent = new String(
Files.readAllBytes(Paths.get(expectedFile.toURI())), ENCODING);
+
+ // On windows, \r\n will be written to the XML. Replace them with \n for
+ // proper comparison.
+ String sysLineSeparator = System.getProperty(LINE_SEPARATOR_PROPERTY);
+ writtenXML = writtenXML.replace(sysLineSeparator, "\n");
+
assertEquals(expectedContent, writtenXML);
}