mirror of
https://gitee.com/kekingcn/file-online-preview.git
synced 2026-09-13 08:24:55 +00:00
重构了EncodingDetectors#getJavaEncode(String filePath)方法,并附带部分测试数据
重构了EncodingDetectors#getJavaEncode(String filePath)方法,并附带部分测试数据 Co-authored-by: asiawu <asiawu3@qq.com> Co-committed-by: asiawu <asiawu3@qq.com>
This commit is contained in:
28
server/src/test/java/cn/keking/EncodingTests.java
Normal file
28
server/src/test/java/cn/keking/EncodingTests.java
Normal file
@@ -0,0 +1,28 @@
|
||||
package cn.keking;
|
||||
|
||||
import cn.keking.utils.EncodingDetects;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.URISyntaxException;
|
||||
|
||||
/**
|
||||
* 编码检测测试类
|
||||
*
|
||||
* @author asiawu3
|
||||
* @create 2023-07-24 16:53
|
||||
**/
|
||||
@SpringBootTest
|
||||
public class EncodingTests {
|
||||
@Test
|
||||
void testCharDet() throws URISyntaxException {
|
||||
for (int i = 0; i < 28; i++) {
|
||||
File dir = new File(getClass().getClassLoader().getResource("testData\\" + i).toURI());
|
||||
String dirPath = dir.getPath();
|
||||
String textFileName = dir.list()[0];
|
||||
String textFilePath = dirPath + "/" + textFileName;
|
||||
System.out.printf("%-15s -->\t %-10s\n", textFileName, EncodingDetects.getJavaEncode(textFilePath));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,10 +4,8 @@ import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
@SpringBootTest
|
||||
class ServerMainTests {
|
||||
|
||||
class ServerMainTests {
|
||||
@Test
|
||||
void contextLoads() {
|
||||
void contextLoads() {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user