ClassUtil { public static Object findEnumConstant(Class<?> type, String constantName) { return findEnumConstant(type, constantName, true); }  static Object findEnumConstant(Class<?> type, String constantName); static Object findEnumConstant(Class<?> type, String constantName, boolean caseSensitive); static Class<?>[] getClassHierarchy(Class<?> type); static boolean hasBeanMethods(Class<?> type, String propertyName, Class<?> propertyType, boolean caseSensitive); static Method[] getBeanMethods(Class<?> type, String propertyName, Class<?> propertyType, boolean caseSensitive); static Method getMethod(Class<?> type, String name, Class<?> returnType, Class<?> paramType, boolean caseSensitive);  }
@Test public void findEnumConstant() throws Exception { 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)); 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)); }