|
| 1 | +/* |
| 2 | + * To change this template, choose Tools | Templates |
| 3 | + * and open the template in the editor. |
| 4 | + */ |
| 5 | +package com.silverpeas.openoffice; |
| 6 | + |
| 7 | +import com.silverpeas.openoffice.util.MsOfficeType; |
| 8 | +import org.junit.Test; |
| 9 | +import static junit.framework.Assert.*; |
| 10 | + |
| 11 | +/** |
| 12 | + * |
| 13 | + * @author ehugonnet |
| 14 | + */ |
| 15 | +public class MimeTypesTest { |
| 16 | + |
| 17 | + @Test |
| 18 | + public void testMsDoc() throws Exception { |
| 19 | + assertEquals(MsOfficeType.WORD, Launcher.getContentType("file:///HelloWorld.doc")); |
| 20 | + assertEquals(MsOfficeType.WORD, Launcher.getContentType("file:///HelloWorld.DOC")); |
| 21 | + assertEquals(MsOfficeType.WORD, Launcher.getContentType("file:///hello world.doc")); |
| 22 | + assertEquals(MsOfficeType.WORD, Launcher.getContentType("file:///HelloWorld.dOcx")); |
| 23 | + assertEquals(MsOfficeType.WORD, Launcher.getContentType("file:///HelloWorld.docm")); |
| 24 | + } |
| 25 | + |
| 26 | + @Test |
| 27 | + public void testMsExcel() throws Exception { |
| 28 | + assertEquals(MsOfficeType.EXCEL, Launcher.getContentType("file:///HelloWorld.xls")); |
| 29 | + assertEquals(MsOfficeType.EXCEL, Launcher.getContentType("file:///HelloWorld.XLS")); |
| 30 | + assertEquals(MsOfficeType.EXCEL, Launcher.getContentType("file:///hello world.xls")); |
| 31 | + assertEquals(MsOfficeType.EXCEL, Launcher.getContentType("file:///HelloWorld.xLsx")); |
| 32 | + } |
| 33 | + |
| 34 | + @Test |
| 35 | + public void testMsPowerpoint() throws Exception { |
| 36 | + assertEquals(MsOfficeType.POWERPOINT, Launcher.getContentType("file:///HelloWorld.ppt")); |
| 37 | + assertEquals(MsOfficeType.POWERPOINT, Launcher.getContentType("file:///HelloWorld.PPT")); |
| 38 | + assertEquals(MsOfficeType.POWERPOINT, Launcher.getContentType("file:///hello world.PPtx")); |
| 39 | + } |
| 40 | +} |
0 commit comments