|
|
@ -19,6 +19,8 @@ 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
|
|
|
@ -27,4 +29,13 @@ public class FileUtilTest {
|
|
|
|
String contentByFileUtil = FileUtil.readUtf8String(testFilePath);
|
|
|
|
String contentByFileUtil = FileUtil.readUtf8String(testFilePath);
|
|
|
|
Assert.notEmpty(contentByFileUtil);
|
|
|
|
Assert.notEmpty(contentByFileUtil);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
|
|
|
public void assertReadUtf8String2() {
|
|
|
|
|
|
|
|
String testText = "abcd简体繁体\uD83D\uDE04\uD83D\uDD25& *\nsecond line\n" +
|
|
|
|
|
|
|
|
"empty line next\n";
|
|
|
|
|
|
|
|
String testFilePath = "test/test_utf8.txt";
|
|
|
|
|
|
|
|
String contentByFileUtil = FileUtil.readUtf8String(testFilePath);
|
|
|
|
|
|
|
|
Assert.isTrue(testText.equals(contentByFileUtil));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|