### Question:
SMGlobalPolicyUtil { public static CommponentType convertComponentType(String type) { return Enum.valueOf(CommponentType.class, type); }  static CommponentType convertComponentType(String type); static PermissionCollection getEECompGrantededPerms(CommponentType type); static PermissionCollection getEECompGrantededPerms(String type); static PermissionCollection getCompRestrictedPerms(CommponentType type); static PermissionCollection getCompRestrictedPerms(String 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() { SMGlobalPolicyUtil.CommponentType t = SMGlobalPolicyUtil.convertComponentType("ejb"); System.out.println("Converted type = " + t); Assert.assertEquals("Converted type should be Ejb", SMGlobalPolicyUtil.CommponentType.ejb, t); t = SMGlobalPolicyUtil.convertComponentType("ear"); System.out.println("Converted type = " + t); Assert.assertEquals("Converted type should be ear", SMGlobalPolicyUtil.CommponentType.ear, t); t = SMGlobalPolicyUtil.convertComponentType("war"); System.out.println("Converted type = " + t); Assert.assertEquals("Converted type should be web", SMGlobalPolicyUtil.CommponentType.war, t); t = SMGlobalPolicyUtil.convertComponentType("rar"); System.out.println("Converted type = " + t); Assert.assertEquals("Converted type should be rar", SMGlobalPolicyUtil.CommponentType.rar, t); t = SMGlobalPolicyUtil.convertComponentType("car"); System.out.println("Converted type = " + t); Assert.assertEquals("Converted type should be car", SMGlobalPolicyUtil.CommponentType.car, t); try { t = SMGlobalPolicyUtil.convertComponentType(""); Assert.fail(); } catch (IllegalArgumentException e) { } try { t = SMGlobalPolicyUtil.convertComponentType("bla"); Assert.fail(); } catch (IllegalArgumentException e) { } try { t = SMGlobalPolicyUtil.convertComponentType(null); Assert.fail(); } catch (NullPointerException e) { } }