@Test
public void testInvalidConfigurationValues() throws Exception {

  final List<StorageLocation> locations =
      makeMockLocations(HEALTHY, HEALTHY, HEALTHY);
  Configuration conf = new HdfsConfiguration();
  conf.setInt(DFS_DATANODE_FAILED_VOLUMES_TOLERATED_KEY, 4);
  intercept(HadoopIllegalArgumentException.class,
      "Invalid value configured for dfs.datanode.failed.volumes.tolerated"
          + " - 4. Value configured is >= to the "
          + "number of configured volumes (3).",
      () -> new StorageLocationChecker(conf, new FakeTimer()).check(conf,
          locations));
  conf.unset(DFS_DATANODE_FAILED_VOLUMES_TOLERATED_KEY);
  conf.setInt(DFS_DATANODE_DISK_CHECK_TIMEOUT_KEY, 0);
  intercept(HadoopIllegalArgumentException.class,
      "Invalid value configured for dfs.datanode.disk.check.timeout"
          + " - 0 (should be > 0)",
      () -> new StorageLocationChecker(conf, new FakeTimer()));
  conf.unset(DFS_DATANODE_DISK_CHECK_TIMEOUT_KEY);
  conf.setInt(DFS_DATANODE_FAILED_VOLUMES_TOLERATED_KEY, -2);
  intercept(HadoopIllegalArgumentException.class,
      "Invalid value configured for dfs.datanode.failed.volumes.tolerated"
          + " - -2 should be greater than or equal to -1",
      () -> new StorageLocationChecker(conf, new FakeTimer()));
}