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