@Test(expected = UpdateServiceRequestNotAllowedException.class) public void test_should_throw_exception_when_anonymous_user_attempts_to_update_request() { final AuthenticatedUser user = AuthenticatedUser.createAnonymousUser(); service.validate("crn", "tenantId", user); }
public void validate(String serviceRequestId, String tenantId, AuthenticatedUser user) { validateAnonymousUserNotAllowedToUpdate(user); validateCitizenUpdateEligibility(serviceRequestId, tenantId, user); validateEmployeeUpdateEligibility(serviceRequestId, tenantId, user); }
UpdateServiceRequestEligibilityService { public void validate(String serviceRequestId, String tenantId, AuthenticatedUser user) { validateAnonymousUserNotAllowedToUpdate(user); validateCitizenUpdateEligibility(serviceRequestId, tenantId, user); validateEmployeeUpdateEligibility(serviceRequestId, tenantId, user); } }
UpdateServiceRequestEligibilityService { public void validate(String serviceRequestId, String tenantId, AuthenticatedUser user) { validateAnonymousUserNotAllowedToUpdate(user); validateCitizenUpdateEligibility(serviceRequestId, tenantId, user); validateEmployeeUpdateEligibility(serviceRequestId, tenantId, user); } UpdateServiceRequestEligibilityService(SubmissionRepository submissionRepository,
                                                  EmployeeRepository employeeRepository); }
UpdateServiceRequestEligibilityService { public void validate(String serviceRequestId, String tenantId, AuthenticatedUser user) { validateAnonymousUserNotAllowedToUpdate(user); validateCitizenUpdateEligibility(serviceRequestId, tenantId, user); validateEmployeeUpdateEligibility(serviceRequestId, tenantId, user); } UpdateServiceRequestEligibilityService(SubmissionRepository submissionRepository,
                                                  EmployeeRepository employeeRepository); void validate(String serviceRequestId, String tenantId, AuthenticatedUser user); }
UpdateServiceRequestEligibilityService { public void validate(String serviceRequestId, String tenantId, AuthenticatedUser user) { validateAnonymousUserNotAllowedToUpdate(user); validateCitizenUpdateEligibility(serviceRequestId, tenantId, user); validateEmployeeUpdateEligibility(serviceRequestId, tenantId, user); } UpdateServiceRequestEligibilityService(SubmissionRepository submissionRepository,
                                                  EmployeeRepository employeeRepository); void validate(String serviceRequestId, String tenantId, AuthenticatedUser user);  }