Ensure the use of UTF-8 encoding in ImageBannerTests

Closes gh-18301
This commit is contained in:
Andy Wilkinson 2019-09-22 20:31:51 +01:00
parent ec2483e897
commit e6d60d937e
1 changed files with 8 additions and 2 deletions

View File

@ -18,6 +18,7 @@ package org.springframework.boot;
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.io.UnsupportedEncodingException;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
@ -204,8 +205,13 @@ class ImageBannerTests {
ConfigurableEnvironment environment = new MockEnvironment();
TestPropertySourceUtils.addInlinedPropertiesToEnvironment(environment, properties);
ByteArrayOutputStream out = new ByteArrayOutputStream();
banner.printBanner(environment, getClass(), new PrintStream(out));
return out.toString();
try {
banner.printBanner(environment, getClass(), new PrintStream(out, false, "UTF-8"));
return out.toString("UTF-8");
}
catch (UnsupportedEncodingException ex) {
throw new IllegalStateException(ex);
}
}
}