pull/664/merge
liulinfei121 3 years ago committed by GitHub
commit 4c3f78c2dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -19,6 +19,8 @@ package cn.hippo4j.common.toolkit;
import org.junit.Test;
import java.io.UnsupportedEncodingException;
public class FileUtilTest {
@Test
@ -27,4 +29,13 @@ public class FileUtilTest {
String contentByFileUtil = FileUtil.readUtf8String(testFilePath);
Assert.notEmpty(contentByFileUtil);
}
}
@Test
public void assertReadUtf8String2() throws UnsupportedEncodingException {
String testText = new String(("abcd简体繁体\uD83D\uDE04\uD83D\uDD25& *\r\nsecond line\r\n" +
"empty line next\r\n").getBytes(),"utf-8");
String testFilePath = "test/test_utf8.txt";
String contentByFileUtil = FileUtil.readUtf8String(testFilePath);
Assert.isTrue(testText.equals(contentByFileUtil));
}
}
Loading…
Cancel
Save