@Test public void testCheckPermissions() { doNothing().when(commonPermissionCheckingUtils).checkPermissionForUser(any(), anyString()); CheckPermissionByAccount rawMethodAnnotation = new CheckPermissionByAccount() { @Override public Class<? extends Annotation> annotationType() { return CheckPermissionByAccount.class; } @Override public AuthorizationResourceAction action() { return AuthorizationResourceAction.ENVIRONMENT_WRITE; } }; underTest.checkPermissions(rawMethodAnnotation, USER_CRN, null, null, 0L); verify(commonPermissionCheckingUtils) .checkPermissionForUser(eq(AuthorizationResourceAction.ENVIRONMENT_WRITE), eq(USER_CRN)); verify(commonPermissionCheckingUtils, times(0)).checkPermissionForUserOnResource(any(), anyString(), anyString()); }
@Override public <T extends Annotation> void checkPermissions(T rawMethodAnnotation, String userCrn, ProceedingJoinPoint proceedingJoinPoint, MethodSignature methodSignature, long startTime) { CheckPermissionByAccount methodAnnotation = (CheckPermissionByAccount) rawMethodAnnotation; AuthorizationResourceAction action = methodAnnotation.action(); commonPermissionCheckingUtils.checkPermissionForUser(action, userCrn); }
DefaultPermissionChecker implements PermissionChecker<CheckPermissionByAccount> { @Override public <T extends Annotation> void checkPermissions(T rawMethodAnnotation, String userCrn, ProceedingJoinPoint proceedingJoinPoint, MethodSignature methodSignature, long startTime) { CheckPermissionByAccount methodAnnotation = (CheckPermissionByAccount) rawMethodAnnotation; AuthorizationResourceAction action = methodAnnotation.action(); commonPermissionCheckingUtils.checkPermissionForUser(action, userCrn); } }
DefaultPermissionChecker implements PermissionChecker<CheckPermissionByAccount> { @Override public <T extends Annotation> void checkPermissions(T rawMethodAnnotation, String userCrn, ProceedingJoinPoint proceedingJoinPoint, MethodSignature methodSignature, long startTime) { CheckPermissionByAccount methodAnnotation = (CheckPermissionByAccount) rawMethodAnnotation; AuthorizationResourceAction action = methodAnnotation.action(); commonPermissionCheckingUtils.checkPermissionForUser(action, userCrn); }  }
DefaultPermissionChecker implements PermissionChecker<CheckPermissionByAccount> { @Override public <T extends Annotation> void checkPermissions(T rawMethodAnnotation, String userCrn, ProceedingJoinPoint proceedingJoinPoint, MethodSignature methodSignature, long startTime) { CheckPermissionByAccount methodAnnotation = (CheckPermissionByAccount) rawMethodAnnotation; AuthorizationResourceAction action = methodAnnotation.action(); commonPermissionCheckingUtils.checkPermissionForUser(action, userCrn); }  @Override void checkPermissions(T rawMethodAnnotation, String userCrn, ProceedingJoinPoint proceedingJoinPoint,
            MethodSignature methodSignature, long startTime); @Override Class<CheckPermissionByAccount> supportedAnnotation(); }
DefaultPermissionChecker implements PermissionChecker<CheckPermissionByAccount> { @Override public <T extends Annotation> void checkPermissions(T rawMethodAnnotation, String userCrn, ProceedingJoinPoint proceedingJoinPoint, MethodSignature methodSignature, long startTime) { CheckPermissionByAccount methodAnnotation = (CheckPermissionByAccount) rawMethodAnnotation; AuthorizationResourceAction action = methodAnnotation.action(); commonPermissionCheckingUtils.checkPermissionForUser(action, userCrn); }  @Override void checkPermissions(T rawMethodAnnotation, String userCrn, ProceedingJoinPoint proceedingJoinPoint,
            MethodSignature methodSignature, long startTime); @Override Class<CheckPermissionByAccount> supportedAnnotation();  }