If the problem is spaces at the beginning / end:
assertEquals(actual.trim(), expected.trim());
If the problem is with the contents of the file, the only solution I can come up with is to remove all spaces from both inputs:
assertEquals(removeWhiteSpaces(actual), removeWhiteSpaces(expected));
where the removeWhiteSpaces () method looks like this:
String removeWhiteSpaces(String input) {
return input.replaceAll("\\s+", "");
}
ioseb source
share