示例#1
0
  public void testBasic() {
    MIMEType mime = new MIMEType("application", "x-tm+xml", "1.0");
    assertEquals("wrong main type", mime.getMainType(), "application");
    assertEquals("wrong subtype", mime.getSubType(), "x-tm+xml");
    assertEquals("wrong version", mime.getVersion(), "1.0");

    mime = new MIMEType("application", "x-tm+xml", null);
    assertEquals("wrong main type", mime.getMainType(), "application");
    assertEquals("wrong subtype", mime.getSubType(), "x-tm+xml");
    assertEquals("wrong version", mime.getVersion(), null);
  }
示例#2
0
 public void testParseCharset() {
   MIMEType mime = new MIMEType("application/x-tm+xml; charset=utf-8");
   assertEquals("wrong main type", mime.getMainType(), "application");
   assertEquals("wrong subtype", mime.getSubType(), "x-tm+xml");
   assertEquals("wrong version", null, mime.getVersion());
 }
示例#3
0
 public void testParseVersionMalformed5() {
   MIMEType mime = new MIMEType("application/x-tm+xml;version !");
   assertEquals("wrong main type", mime.getMainType(), "application");
   assertEquals("wrong subtype", mime.getSubType(), "x-tm+xml");
   assertEquals("wrong version", null, mime.getVersion());
 }
示例#4
0
 public void testParseVersionLotsOfSpaces() {
   MIMEType mime = new MIMEType("application/x-tm+xml; version = 1.0  ");
   assertEquals("wrong main type", mime.getMainType(), "application");
   assertEquals("wrong subtype", mime.getSubType(), "x-tm+xml");
   assertEquals("wrong version", "1.0", mime.getVersion());
 }