### Question:
GlobalPolicyUtil { public static CommponentType convertComponentType(String type) { return Enum.valueOf(CommponentType.class, type); }  static CommponentType convertComponentType(String type); static PermissionCollection getDeclaredPermissions(CommponentType type, DeploymentContext context); static PermissionCollection getEECompGrantededPerms(String type); static PermissionCollection getEECompGrantededPerms(CommponentType type); static PermissionCollection getCompRestrictedPerms(String type); static PermissionCollection getCompRestrictedPerms(CommponentType type); static void checkRestriction(CommponentType type, PermissionCollection declaredPC); static void checkRestriction(PermissionCollection declaredPC, PermissionCollection restrictedPC); static void checkRestrictionOfComponentType(PermissionCollection declaredPC, CommponentType type); static void checkRestrictionOfEar(PermissionCollection declaredPC); static final String EE_GRANT_FILE; static final String EE_RESTRICTED_FILE; static final String SERVER_ALLOWED_FILE; static final String EJB_TYPE_CODESOURCE; static final String WEB_TYPE_CODESOURCE; static final String RAR_TYPE_CODESOURCE; static final String CLIENT_TYPE_CODESOURCE; static final String EAR_TYPE_CODESOURCE; static final String EAR_CLASS_LOADER; }### Answer:
@Test public void testTYpeConvert() { for (CommponentType commponentType : CommponentType.values()) { CommponentType convertedType = GlobalPolicyUtil.convertComponentType(commponentType.name()); System.out.println("Converted type = " + convertedType); Assert.assertEquals("Converted type should be " + commponentType.name(), commponentType, convertedType); } try { GlobalPolicyUtil.convertComponentType(""); Assert.fail(); } catch (IllegalArgumentException e) { } try { GlobalPolicyUtil.convertComponentType("bla"); Assert.fail(); } catch (IllegalArgumentException e) { } try { GlobalPolicyUtil.convertComponentType(null); Assert.fail(); } catch (NullPointerException e) { } }