fix FileUtilTest case

pull/670/head
liulinfei121 3 years ago
parent e16fe49f5f
commit abac423fd0

@ -19,8 +19,6 @@ package cn.hippo4j.common.toolkit;
import org.junit.Test; import org.junit.Test;
import java.io.UnsupportedEncodingException;
public class FileUtilTest { public class FileUtilTest {
@Test @Test
@ -32,10 +30,12 @@ public class FileUtilTest {
@Test @Test
public void assertReadUtf8String2() { public void assertReadUtf8String2() {
String testText = "abcd简体繁体\uD83D\uDE04\uD83D\uDD25& *\nsecond line\n" + String linebreaks = System.getProperty("line.separator");
"empty line next\n"; String testText = "abcd简体繁体\uD83D\uDE04\uD83D\uDD25& *" + linebreaks +
"second line" + linebreaks +
"empty line next" + linebreaks;
String testFilePath = "test/test_utf8.txt"; String testFilePath = "test/test_utf8.txt";
String contentByFileUtil = FileUtil.readUtf8String(testFilePath); String contentByFileUtil = FileUtil.readUtf8String(testFilePath);
Assert.isTrue(testText.equals(contentByFileUtil)); Assert.isTrue(testText.equals(contentByFileUtil));
} }
} }

Loading…
Cancel
Save