FileDocCategorySizeDatePackage
FileNameMapTest.javaAPI DocAndroid 1.5 API1731Wed May 06 22:41:04 BST 2009tests.api.java.net

FileNameMapTest

public class FileNameMapTest extends TestCase

Fields Summary
Constructors Summary
Methods Summary
public voidtest_getContentTypeFor()

        String [] files = {"text", "txt", "htm", "html"}; 
        
        String [] mimeTypes = {"text/plain", "text/plain", 
                "text/html", "text/html"}; 
        
        FileNameMap fileNameMap = URLConnection.getFileNameMap();
        
        for(int i = 0; i < files.length; i++) {
            String mimeType = fileNameMap.getContentTypeFor("test." + files[i]);
            assertEquals("getContentTypeFor returns incorrect MIME type for " +
                    files[i], mimeTypes[i], mimeType);
        }