### Question:
MoreMapUtils { public static Path getHadoopPath(Map<?, ?> map, Object key, Path defaultValue) { Object path = map.get(key); if (path == null) { return defaultValue; } if (path instanceof Path) { return (Path) path; } if (path instanceof String) { return new Path(((String) path).trim()); } throw new IllegalArgumentException( "Object '" + key + "' must be a String or a Path. Got " + path.getClass().getName()); } private  MoreMapUtils(); static List<T> getListOfEnum(
      Map<?, ?> map,
      Object key,
      List<T> defaultValue,
      final Class<T> enumClass); static Path getHadoopPath(Map<?, ?> map, Object key, Path defaultValue); static URI getUri(Map<?, ?> map, Object key, URI defaultValue);  }### Answer:
@Test(expected = IllegalArgumentException.class) public void invalidHadoopPath() { Map<?, ?> map = newMap(KEY, Integer.valueOf(100)); MoreMapUtils.getHadoopPath(map, KEY, null); }
@Test public void noKeyReturnsDefaultHadoopPath() { Map<?, ?> map = newMap(KEY + "_+", "abc"); Path defaultPath = new Path("myPath"); assertThat(MoreMapUtils.getHadoopPath(map, KEY, defaultPath), is(defaultPath)); }
@Test public void nullHadoopPath() { Map<?, ?> map = newMap(KEY, null); assertThat(MoreMapUtils.getHadoopPath(map, KEY, null), is(nullValue())); }
@Test public void hadoopPath() { Path path = new Path("myPath"); Map<?, ?> map = newMap(KEY, path); assertThat(MoreMapUtils.getHadoopPath(map, KEY, null), is(path)); }
@Test public void hadoopPathAsString() { Map<?, ?> map = newMap(KEY, "myStringPath"); assertThat(MoreMapUtils.getHadoopPath(map, KEY, null), is(new Path("myStringPath"))); }
@Test(expected = IllegalArgumentException.class) public void invalidPathType() { Map<?, ?> map = newMap(KEY, new Object()); MoreMapUtils.getHadoopPath(map, KEY, null); }