1 17 package org.alfresco.repo.content; 18 19 import java.util.Map ; 20 21 import org.alfresco.util.BaseSpringTest; 22 23 28 public class MimetypeMapTest extends BaseSpringTest 29 { 30 private MimetypeMap mimetypeMap; 31 32 public void setMimetypeMap(MimetypeMap mimetypeMap) 33 { 34 this.mimetypeMap = mimetypeMap; 35 } 36 37 public void testExtensions() throws Exception 38 { 39 Map <String , String > extensionsByMimetype = mimetypeMap.getExtensionsByMimetype(); 40 Map <String , String > mimetypesByExtension = mimetypeMap.getMimetypesByExtension(); 41 42 assertEquals("txt", extensionsByMimetype.get("text/plain")); 44 assertEquals("text/plain", mimetypesByExtension.get("txt")); 45 assertEquals("text/plain", mimetypesByExtension.get("csv")); 46 assertEquals("text/plain", mimetypesByExtension.get("java")); 47 48 assertEquals("jpg", extensionsByMimetype.get("image/jpeg")); 50 assertEquals("image/jpeg", mimetypesByExtension.get("jpg")); 51 assertEquals("image/jpeg", mimetypesByExtension.get("jpeg")); 52 assertEquals("image/jpeg", mimetypesByExtension.get("jpe")); 53 54 assertEquals("doc", extensionsByMimetype.get("application/msword")); 56 assertEquals("application/msword", mimetypesByExtension.get("doc")); 57 58 assertEquals("sds", extensionsByMimetype.get("application/vnd.stardivision.chart")); 60 } 61 } 62 | Popular Tags |