fix FileUtilTest case

pull/664/head
liulinfei121 3 years ago
parent 0b29467946
commit 2f333de837

@ -19,6 +19,8 @@ package cn.hippo4j.common.toolkit;
import org.junit.Test;
import java.io.UnsupportedEncodingException;
public class FileUtilTest {
@Test
@ -29,10 +31,9 @@ public class FileUtilTest {
}
@Test
public void assertReadUtf8String2() {
String testText = "abcd简体繁体\uD83D\uDE04\uD83D\uDD25& *\r\n" +
"second line\r\n" +
"empty line next\r\n";
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