BloombergPermissions { public static int extractEid(String permissionString) { ArgumentChecker.notNull(permissionString, "permissionString"); if (isEid(permissionString) == false) { throw new IllegalArgumentException("Permission string does not represent an EID: " + permissionString); } String eidStr = permissionString.substring(EID_PREFIX.length()); try { return Integer.parseInt(eidStr); } catch (RuntimeException ex) { throw new IllegalArgumentException("Permission string does not represent a valid EID: " + permissionString); } } private  BloombergPermissions(); static Permission createEidPermission(int eid); static String createEidPermissionString(int eid); static boolean isEid(String permissionString); static int extractEid(String permissionString); static final String BLOOMBERG_PREFIX; static final String EID_PREFIX; static final Permission PERMISSION_BLOOMBERG; }
@Test(expectedExceptions = IllegalArgumentException.class) public void testExtractEid_null() { BloombergPermissions.extractEid(null); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testExtractEid_empty() { BloombergPermissions.extractEid(""); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testExtractEid_invalid() { BloombergPermissions.extractEid(BloombergPermissions.EID_PREFIX + "abcd"); }