mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
fix FileTypeUtil
This commit is contained in:
@@ -6,6 +6,9 @@ import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* 文件类型判断单元测试
|
||||
@@ -13,19 +16,19 @@ import java.io.File;
|
||||
*
|
||||
*/
|
||||
public class FileTypeUtilTest {
|
||||
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void fileTypeUtilTest() {
|
||||
File file = FileUtil.file("hutool.jpg");
|
||||
String type = FileTypeUtil.getType(file);
|
||||
Assert.assertEquals("jpg", type);
|
||||
|
||||
|
||||
FileTypeUtil.putFileType("ffd8ffe000104a464946", "new_jpg");
|
||||
String newType = FileTypeUtil.getType(file);
|
||||
Assert.assertEquals("new_jpg", newType);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void emptyTest() {
|
||||
@@ -41,4 +44,16 @@ public class FileTypeUtilTest {
|
||||
String type = FileTypeUtil.getType(file);
|
||||
Console.log(type);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void ofdTest() {
|
||||
File file = FileUtil.file("e:/test.ofd");
|
||||
String hex = IoUtil.readHex28Upper(FileUtil.getInputStream(file));
|
||||
Console.log(hex);
|
||||
String type = FileTypeUtil.getType(file);
|
||||
Console.log(type);
|
||||
Assert.assertEquals("odf", type);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user