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 aad955d3bf
commit 2f6911a8ae
1 changed files with 5 additions and 4 deletions

View File

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