[errorprone] Fix implicit use of default charset in FileBasedConfigTest

Change-Id: I83332efc498a5bce242915a1eec2346e6e1f58fd
This commit is contained in:
Matthias Sohn 2022-01-12 02:02:35 +01:00
parent 2fed62528a
commit 8b00cb9324
1 changed files with 5 additions and 2 deletions

View File

@ -19,6 +19,7 @@
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardOpenOption;
@ -276,7 +277,8 @@ public void testSavedConfigFileShouldNotReadUserGitConfig()
throws IOException {
AtomicBoolean userConfigTimeRead = new AtomicBoolean(false);
Path userConfigFile = createFile(CONTENT1.getBytes(), "home");
Path userConfigFile = createFile(
CONTENT1.getBytes(StandardCharsets.UTF_8), "home");
mockSystemReader.setUserGitConfig(
new FileBasedConfig(userConfigFile.toFile(), FS.DETECTED) {
@ -289,7 +291,8 @@ public long getTimeUnit(String section, String subsection,
}
});
Path file = createFile(CONTENT2.getBytes(), "repo");
Path file = createFile(CONTENT2.getBytes(StandardCharsets.UTF_8),
"repo");
FileBasedConfig fileBasedConfig = new FileBasedConfig(file.toFile(),
FS.DETECTED);
fileBasedConfig.save();