コード例 #1
0
  @Test
  public void testGetFileExtensionForEmptyMimeType() throws Exception {
    CustomMimeTypeResolver resolver = new CustomMimeTypeResolver();
    resolver.setCustomMimeTypes(new String[] {"nitf=image/nitf", "ntf=image/nitf"});

    String fileExtension = resolver.getFileExtensionForMimeType("");
    assertEquals(null, fileExtension);
  }
コード例 #2
0
  @Test
  public void testGetFileExtensionForMimeType_MultipleMappings() throws Exception {
    CustomMimeTypeResolver resolver = new CustomMimeTypeResolver();
    resolver.setCustomMimeTypes(new String[] {"nitf=image/nitf", "ntf=image/nitf"});

    String fileExtension = resolver.getFileExtensionForMimeType("image/nitf");
    assertEquals(".nitf", fileExtension);
  }