Fix test assertion

Make sure to normalize the content that's read from disk to ensure
to adapt any platform-specific characters.

Closes gh-247
This commit is contained in:
Stephane Nicoll
2016-07-08 14:45:57 +02:00
parent 0ac320e5ae
commit bd323680ea

View File

@@ -38,14 +38,14 @@ class SourceCodeAssert {
SourceCodeAssert(String name, String content) { SourceCodeAssert(String name, String content) {
this.name = name this.name = name
this.content = content this.content = content.normalize()
} }
SourceCodeAssert equalsTo(Resource expected) { SourceCodeAssert equalsTo(Resource expected) {
def stream = expected.inputStream def stream = expected.inputStream
try { try {
String expectedContent = StreamUtils.copyToString(stream, Charset.forName('UTF-8')) String expectedContent = StreamUtils.copyToString(stream, Charset.forName('UTF-8'))
assertEquals "Unexpected content for $name", expectedContent, content assertEquals "Unexpected content for $name", expectedContent.normalize(), content
} finally { } finally {
stream.close() stream.close()
} }