### Question:
WhitelistOptionParser { Set<Permission> parseTargetOperation(String inputOption, IResource resource) { String operationString = stripOptionPrefix(inputOption).toUpperCase(); if (ALL_OPERATIONS.equals(operationString)) { return resource.applicablePermissions(); } try { return ImmutableSet.of(Permission.valueOf(operationString)); } catch (IllegalArgumentException e) { throw Exceptions.appendCause(new InvalidRequestException("Invalid whitelist option: " + e.getMessage()), e); } }    }### Answer:
@Test public void testParseGrantSelect() { Set<Permission> operations = parser.parseTargetOperation("grant_audit_whitelist_for_select", DataResource.fromName("data")); assertThat(operations).containsExactlyInAnyOrder(Permission.SELECT); }
@Test public void testParseRevokeSelect() { Set<Permission> operations = parser.parseTargetOperation("revoke_audit_whitelist_for_select", DataResource.fromName("data")); assertThat(operations).containsExactlyInAnyOrder(Permission.SELECT); }
@Test public void testParseGrantModify() { Set<Permission> operations = parser.parseTargetOperation("grant_audit_whitelist_for_modify", DataResource.fromName("data")); assertThat(operations).containsExactlyInAnyOrder(Permission.MODIFY); }
@Test public void testParseGrantModifyUppercaseAndSpace() { Set<Permission> operations = parser.parseTargetOperation("GRANT AUDIT WHITELIST FOR MODIFY", DataResource.fromName("data")); assertThat(operations).containsExactlyInAnyOrder(Permission.MODIFY); }
@Test public void testParseGrantAll() { Set<Permission> operations = parser.parseTargetOperation("grant_audit_whitelist_for_all", DataResource.fromName("data")); assertThat(operations).containsExactlyInAnyOrder(Permission.CREATE, Permission.ALTER, Permission.DROP, Permission.SELECT, Permission.MODIFY, Permission.AUTHORIZE); }
@Test public void testParseGrantGuck() { assertThatExceptionOfType(InvalidRequestException.class) .isThrownBy(() -> parser.parseTargetOperation("grant_audit_whitelist_for_guck", DataResource.fromName("data"))); }