@Test
  public void testGetMimeTypeForEmptyFileExtension() throws Exception {
    CustomMimeTypeResolver resolver = new CustomMimeTypeResolver();
    resolver.setCustomMimeTypes(new String[] {"nitf=image/nitf", "ntf=image/nitf"});

    String mimeType = resolver.getMimeTypeForFileExtension("");
    assertEquals(null, mimeType);
  }
  @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);
  }
  @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);
  }
  @Test
  public void testSetSingleCustomMimeTypes() {
    CustomMimeTypeResolver resolver = new CustomMimeTypeResolver();
    resolver.setCustomMimeTypes(new String[] {"nitf=image/nitf"});

    Map<String, List<String>> mimeTypesToFileExtensions =
        resolver.getCustomMimeTypesToFileExtensionsMap();
    assertTrue(mimeTypesToFileExtensions.containsKey("image/nitf"));
    List<String> fileExtensions = mimeTypesToFileExtensions.get("image/nitf");
    assertTrue(fileExtensions.contains("nitf"));

    Map<String, String> fileExtensionsMimeTypes = resolver.getCustomFileExtensionsToMimeTypesMap();
    assertTrue(fileExtensionsMimeTypes.containsKey("nitf"));
    assertEquals("image/nitf", fileExtensionsMimeTypes.get("nitf"));
  }
  @Test
  public void testSetCustomMimeTypeWithMimeParameter() {
    CustomMimeTypeResolver resolver = new CustomMimeTypeResolver();

    resolver.setCustomMimeTypes(new String[] {"xml=text/xml;id=ddms"});

    Map<String, List<String>> mimeTypesToFileExtensions =
        resolver.getCustomMimeTypesToFileExtensionsMap();
    assertTrue(mimeTypesToFileExtensions.containsKey("text/xml;id=ddms"));
    assertFalse(mimeTypesToFileExtensions.containsKey("text/xml"));
    List<String> fileExtensions = mimeTypesToFileExtensions.get("text/xml;id=ddms");
    assertTrue(fileExtensions.contains("xml"));

    Map<String, String> fileExtensionsMimeTypes = resolver.getCustomFileExtensionsToMimeTypesMap();
    assertTrue(fileExtensionsMimeTypes.containsKey("xml"));
    assertEquals("text/xml;id=ddms", fileExtensionsMimeTypes.get("xml"));
  }
  @Test
  public void testSetMultipleCustomMimeTypesToSameFileExtension() {
    CustomMimeTypeResolver resolver = new CustomMimeTypeResolver();

    resolver.setCustomMimeTypes(new String[] {"xml=text/xml", "xml=application/xml"});

    Map<String, List<String>> mimeTypesToFileExtensions =
        resolver.getCustomMimeTypesToFileExtensionsMap();
    assertTrue(mimeTypesToFileExtensions.containsKey("text/xml"));
    assertTrue(mimeTypesToFileExtensions.containsKey("application/xml"));
    List<String> fileExtensions = mimeTypesToFileExtensions.get("text/xml");
    assertTrue(fileExtensions.contains("xml"));
    fileExtensions = mimeTypesToFileExtensions.get("application/xml");
    assertTrue(fileExtensions.contains("xml"));

    Map<String, String> fileExtensionsMimeTypes = resolver.getCustomFileExtensionsToMimeTypesMap();
    assertTrue(fileExtensionsMimeTypes.containsKey("xml"));
    // assertEquals( "text/xml", fileExtensionsMimeTypes.get( "xml" ) );
    assertEquals("application/xml", fileExtensionsMimeTypes.get("xml"));
  }