Fix TestFileMagic

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1847454 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Dominik Stadler 2018-11-26 06:28:17 +00:00
parent c3af0776ec
commit 1468ede3ae

View File

@ -17,6 +17,7 @@
package org.apache.poi.poifs.filesystem; package org.apache.poi.poifs.filesystem;
import org.apache.commons.codec.Charsets;
import org.apache.poi.POIDataSamples; import org.apache.poi.POIDataSamples;
import org.junit.Test; import org.junit.Test;
@ -31,12 +32,12 @@ public class TestFileMagic {
@Test @Test
public void testFileMagic() { public void testFileMagic() {
assertEquals(FileMagic.XML, FileMagic.valueOf("XML")); assertEquals(FileMagic.XML, FileMagic.valueOf("XML"));
assertEquals(FileMagic.XML, FileMagic.valueOf("<?xml".getBytes())); assertEquals(FileMagic.XML, FileMagic.valueOf("<?xml".getBytes(Charsets.UTF_8)));
assertEquals(FileMagic.HTML, FileMagic.valueOf("HTML")); assertEquals(FileMagic.HTML, FileMagic.valueOf("HTML"));
assertEquals(FileMagic.HTML, FileMagic.valueOf("<!DOCTYP".getBytes())); assertEquals(FileMagic.HTML, FileMagic.valueOf("<!DOCTYP".getBytes(Charsets.UTF_8)));
assertEquals(FileMagic.HTML, FileMagic.valueOf("<!DOCTYPE".getBytes())); assertEquals(FileMagic.HTML, FileMagic.valueOf("<!DOCTYPE".getBytes(Charsets.UTF_8)));
assertEquals(FileMagic.HTML, FileMagic.valueOf("<html".getBytes())); assertEquals(FileMagic.HTML, FileMagic.valueOf("<html".getBytes(Charsets.UTF_8)));
try { try {
FileMagic.valueOf("some string"); FileMagic.valueOf("some string");