LANG-290 - Rename isEnum to isValidEnum
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@831687 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
de820ce189
commit
c1590455d2
|
@ -73,7 +73,7 @@ public class EnumUtils {
|
|||
* @param enumClass the class of the <code>enum</code> to get, not null
|
||||
* @return the map of enum names to enums, never null
|
||||
*/
|
||||
public static <E extends Enum<E>> boolean isEnum(Class<E> enumClass, String enumName) {
|
||||
public static <E extends Enum<E>> boolean isValidEnum(Class<E> enumClass, String enumName) {
|
||||
try {
|
||||
Enum.valueOf(enumClass, enumName);
|
||||
return true;
|
||||
|
|
|
@ -60,10 +60,10 @@ public class EnumUtilsTest extends TestCase {
|
|||
}
|
||||
|
||||
public void test_isEnum() {
|
||||
assertEquals(true, EnumUtils.isEnum(Traffic.class, "RED"));
|
||||
assertEquals(true, EnumUtils.isEnum(Traffic.class, "AMBER"));
|
||||
assertEquals(true, EnumUtils.isEnum(Traffic.class, "GREEN"));
|
||||
assertEquals(false, EnumUtils.isEnum(Traffic.class, "PURPLE"));
|
||||
assertEquals(true, EnumUtils.isValidEnum(Traffic.class, "RED"));
|
||||
assertEquals(true, EnumUtils.isValidEnum(Traffic.class, "AMBER"));
|
||||
assertEquals(true, EnumUtils.isValidEnum(Traffic.class, "GREEN"));
|
||||
assertEquals(false, EnumUtils.isValidEnum(Traffic.class, "PURPLE"));
|
||||
}
|
||||
|
||||
public void test_getEnum() {
|
||||
|
|
Loading…
Reference in New Issue