@Override
    public void acceptPolicy(ApplicationId appId, Set<Permission> permissionSet) {

        Application app = applicationAdminService.getApplication(appId);
        if (app == null) {
            log.warn("Unknown Application");
            return;
        }

        states.computeIf(appId,
                Objects::nonNull,
                (id, securityInfo) -> {
                    switch (securityInfo.getState()) {
                        case POLICY_VIOLATED:
                            System.out.println(
                                    "This application has violated the security policy. Please uninstall.");
                            return securityInfo;
                        case SECURED:
                            System.out.println(
                                    "The policy has been accepted already. To review policy, review [app.name]");
                            return securityInfo;
                        case INSTALLED:
                            System.out.println("Please review the security policy prior to accept them");
                            log.warn("Application has not been reviewed");
                            return securityInfo;
                        case REVIEWED:
                            return new SecurityInfo(permissionSet, SECURED);
                        default:
                            return securityInfo;
                    }
                });
    }
@Test
    public void testAcceptPolicy() {
        assertEquals(SECURED, states.get(appId).getState());
        states.compute(appId,
                (id, securityInfo) -> {
                    switch (securityInfo.getState()) {
                        case POLICY_VIOLATED:
                            return new SecurityInfo(securityInfo.getPermissions(), SECURED);
                        case SECURED:
                            return new SecurityInfo(securityInfo.getPermissions(), POLICY_VIOLATED);
                        case INSTALLED:
                            return new SecurityInfo(securityInfo.getPermissions(), REVIEWED);
                        case REVIEWED:
                            return new SecurityInfo(securityInfo.getPermissions(), INSTALLED);
                        default:
                            return securityInfo;
                    }
                });
        assertEquals(POLICY_VIOLATED, states.get(appId).getState());
    }