Testing some perceived odd behavior with MimeTypes object.
This commit is contained in:
parent
c75b76b9a1
commit
06e7813539
|
@ -0,0 +1,50 @@
|
|||
package org.eclipse.jetty.http;
|
||||
|
||||
import org.eclipse.jetty.io.Buffer;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
public class MimeTypesTest
|
||||
{
|
||||
@Test
|
||||
public void testGetMimeByExtension_Gzip()
|
||||
{
|
||||
assertMimeTypeByExtension("application/gzip","test.gz");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetMimeByExtension_Png()
|
||||
{
|
||||
assertMimeTypeByExtension("image/png","test.png");
|
||||
assertMimeTypeByExtension("image/png","TEST.PNG");
|
||||
assertMimeTypeByExtension("image/png","Test.Png");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetMimeByExtension_Png_MultiDot()
|
||||
{
|
||||
assertMimeTypeByExtension("image/png","org.eclipse.jetty.Logo.png");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetMimeByExtension_Png_DeepPath()
|
||||
{
|
||||
assertMimeTypeByExtension("image/png","/org/eclipse/jetty/Logo.png");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetMimeByExtension_Text()
|
||||
{
|
||||
assertMimeTypeByExtension("text/plain","test.txt");
|
||||
assertMimeTypeByExtension("text/plain","TEST.TXT");
|
||||
}
|
||||
|
||||
private void assertMimeTypeByExtension(String expectedMimeType, String filename)
|
||||
{
|
||||
MimeTypes mimetypes = new MimeTypes();
|
||||
Buffer contentType = mimetypes.getMimeByExtension(filename);
|
||||
String prefix = "MimeTypes.getMimeByExtension(" + filename + ")";
|
||||
Assert.assertNotNull(prefix,contentType);
|
||||
Assert.assertEquals(prefix,expectedMimeType,contentType.toString());
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue