@Test
public void findEnumConstant() throws Exception {

    // non-enum classes should just return null
    Assert.assertEquals(null, ClassUtil.findEnumConstant(this.getClass(), "One", true));
    Assert.assertEquals(TestEnum.ONE, ClassUtil.findEnumConstant(TestEnum.class, "ONE", true));
    Assert.assertEquals(TestEnum.ONE, ClassUtil.findEnumConstant(TestEnum.class, "ONE", false));
    // case sensitive search should fail
    Assert.assertEquals(null, ClassUtil.findEnumConstant(TestEnum.class, "One", true));
    Assert.assertEquals(TestEnum.ONE, ClassUtil.findEnumConstant(TestEnum.class, "one", false));
    Assert.assertEquals(TestEnum.Two, ClassUtil.findEnumConstant(TestEnum.class, "Two", true));
    Assert.assertEquals(TestEnum.Two, ClassUtil.findEnumConstant(TestEnum.class, "two", false));
    Assert.assertEquals(null, ClassUtil.findEnumConstant(TestEnum.class, "two", true));
}