@Test(expected = AuthoritiesException.class) public void throwAuthoritiesException() { accessResultExceptionHelper.throwException(AccessResult.create(AccessResultCode.AUTHORIZATION_VALIDATION, "")); }
@Override public void throwException(AccessResult accessResult) { if (accessResult.getCode() == AccessResultCode.PU_PROBLEM) { throw new WebCertServiceException(WebCertServiceErrorCodeEnum.PU_PROBLEM, accessResult.getMessage()); } if (accessResult.getCode() == AccessResultCode.AUTHORIZATION_VALIDATION) { throw new AuthoritiesException(accessResult.getMessage()); } if (accessResult.getCode() == AccessResultCode.AUTHORIZATION_SEKRETESS) { throw new WebCertServiceException(WebCertServiceErrorCodeEnum.AUTHORIZATION_PROBLEM_SEKRETESSMARKERING, accessResult.getMessage()); } if (accessResult.getCode() == AccessResultCode.AUTHORIZATION_SEKRETESS_UNIT) { throw new WebCertServiceException(WebCertServiceErrorCodeEnum.AUTHORIZATION_PROBLEM_SEKRETESSMARKERING_ENHET, accessResult.getMessage()); } throw new WebCertServiceException(WebCertServiceErrorCodeEnum.AUTHORIZATION_PROBLEM, accessResult.getMessage()); }
AccessResultExceptionHelperImpl implements AccessResultExceptionHelper { @Override public void throwException(AccessResult accessResult) { if (accessResult.getCode() == AccessResultCode.PU_PROBLEM) { throw new WebCertServiceException(WebCertServiceErrorCodeEnum.PU_PROBLEM, accessResult.getMessage()); } if (accessResult.getCode() == AccessResultCode.AUTHORIZATION_VALIDATION) { throw new AuthoritiesException(accessResult.getMessage()); } if (accessResult.getCode() == AccessResultCode.AUTHORIZATION_SEKRETESS) { throw new WebCertServiceException(WebCertServiceErrorCodeEnum.AUTHORIZATION_PROBLEM_SEKRETESSMARKERING, accessResult.getMessage()); } if (accessResult.getCode() == AccessResultCode.AUTHORIZATION_SEKRETESS_UNIT) { throw new WebCertServiceException(WebCertServiceErrorCodeEnum.AUTHORIZATION_PROBLEM_SEKRETESSMARKERING_ENHET, accessResult.getMessage()); } throw new WebCertServiceException(WebCertServiceErrorCodeEnum.AUTHORIZATION_PROBLEM, accessResult.getMessage()); } }
AccessResultExceptionHelperImpl implements AccessResultExceptionHelper { @Override public void throwException(AccessResult accessResult) { if (accessResult.getCode() == AccessResultCode.PU_PROBLEM) { throw new WebCertServiceException(WebCertServiceErrorCodeEnum.PU_PROBLEM, accessResult.getMessage()); } if (accessResult.getCode() == AccessResultCode.AUTHORIZATION_VALIDATION) { throw new AuthoritiesException(accessResult.getMessage()); } if (accessResult.getCode() == AccessResultCode.AUTHORIZATION_SEKRETESS) { throw new WebCertServiceException(WebCertServiceErrorCodeEnum.AUTHORIZATION_PROBLEM_SEKRETESSMARKERING, accessResult.getMessage()); } if (accessResult.getCode() == AccessResultCode.AUTHORIZATION_SEKRETESS_UNIT) { throw new WebCertServiceException(WebCertServiceErrorCodeEnum.AUTHORIZATION_PROBLEM_SEKRETESSMARKERING_ENHET, accessResult.getMessage()); } throw new WebCertServiceException(WebCertServiceErrorCodeEnum.AUTHORIZATION_PROBLEM, accessResult.getMessage()); }  }
AccessResultExceptionHelperImpl implements AccessResultExceptionHelper { @Override public void throwException(AccessResult accessResult) { if (accessResult.getCode() == AccessResultCode.PU_PROBLEM) { throw new WebCertServiceException(WebCertServiceErrorCodeEnum.PU_PROBLEM, accessResult.getMessage()); } if (accessResult.getCode() == AccessResultCode.AUTHORIZATION_VALIDATION) { throw new AuthoritiesException(accessResult.getMessage()); } if (accessResult.getCode() == AccessResultCode.AUTHORIZATION_SEKRETESS) { throw new WebCertServiceException(WebCertServiceErrorCodeEnum.AUTHORIZATION_PROBLEM_SEKRETESSMARKERING, accessResult.getMessage()); } if (accessResult.getCode() == AccessResultCode.AUTHORIZATION_SEKRETESS_UNIT) { throw new WebCertServiceException(WebCertServiceErrorCodeEnum.AUTHORIZATION_PROBLEM_SEKRETESSMARKERING_ENHET, accessResult.getMessage()); } throw new WebCertServiceException(WebCertServiceErrorCodeEnum.AUTHORIZATION_PROBLEM, accessResult.getMessage()); }  @Override void throwException(AccessResult accessResult); @Override void throwExceptionIfDenied(AccessResult accessResult); }
AccessResultExceptionHelperImpl implements AccessResultExceptionHelper { @Override public void throwException(AccessResult accessResult) { if (accessResult.getCode() == AccessResultCode.PU_PROBLEM) { throw new WebCertServiceException(WebCertServiceErrorCodeEnum.PU_PROBLEM, accessResult.getMessage()); } if (accessResult.getCode() == AccessResultCode.AUTHORIZATION_VALIDATION) { throw new AuthoritiesException(accessResult.getMessage()); } if (accessResult.getCode() == AccessResultCode.AUTHORIZATION_SEKRETESS) { throw new WebCertServiceException(WebCertServiceErrorCodeEnum.AUTHORIZATION_PROBLEM_SEKRETESSMARKERING, accessResult.getMessage()); } if (accessResult.getCode() == AccessResultCode.AUTHORIZATION_SEKRETESS_UNIT) { throw new WebCertServiceException(WebCertServiceErrorCodeEnum.AUTHORIZATION_PROBLEM_SEKRETESSMARKERING_ENHET, accessResult.getMessage()); } throw new WebCertServiceException(WebCertServiceErrorCodeEnum.AUTHORIZATION_PROBLEM, accessResult.getMessage()); }  @Override void throwException(AccessResult accessResult); @Override void throwExceptionIfDenied(AccessResult accessResult);  }