@Test
  public void testGetNonNegativeInt() {
    Configuration conf = new Configuration();
    conf.set("foo1", "100");
    conf.set("foo2", "-100");
    conf.set("foo3", "0");
    conf.set("foo4", "0.5");
    conf.set("foo5", "9999999999999999");
    conf.set("foo6", "bar");

    int defaultValue = 50;
    assertEquals(100, Utils.getNonNegativeInt(conf, "foo1", defaultValue));
    assertEquals(0, Utils.getNonNegativeInt(conf, "foo2", defaultValue));
    assertEquals(0, Utils.getNonNegativeInt(conf, "foo3", defaultValue));
    assertEquals(defaultValue, Utils.getNonNegativeInt(conf, "foo4", defaultValue));
    assertEquals(defaultValue, Utils.getNonNegativeInt(conf, "foo5", defaultValue));
    assertEquals(defaultValue, Utils.getNonNegativeInt(conf, "foo6", defaultValue));
    assertEquals(defaultValue, Utils.getNonNegativeInt(conf, "foo7", defaultValue));
  }
This class tests the Utils class
test/com/linkedin/drelephant/util/UtilsTest.java