mirror of
https://gitee.com/dcren/initializr.git
synced 2025-09-18 17:48:14 +08:00
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:
@@ -38,14 +38,14 @@ class SourceCodeAssert {
|
||||
|
||||
SourceCodeAssert(String name, String content) {
|
||||
this.name = name
|
||||
this.content = content
|
||||
this.content = content.normalize()
|
||||
}
|
||||
|
||||
SourceCodeAssert equalsTo(Resource expected) {
|
||||
def stream = expected.inputStream
|
||||
try {
|
||||
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 {
|
||||
stream.close()
|
||||
}
|
||||
|
Reference in New Issue
Block a user