@Test public void test_should_not_validate_non_complaints() { final ServiceRequestType serviceRequestType = mock(ServiceRequestType.class); when(serviceRequestType.isComplaintType()).thenReturn(false); final AuthenticatedUser user = mock(AuthenticatedUser.class); when(user.isAnonymousUser()).thenReturn(false); final ServiceRequest serviceRequest = createServiceRequest(serviceRequestType, user); assertFalse(validator.canValidate(serviceRequest)); }
@Override public boolean canValidate(ServiceRequest serviceRequest) { return serviceRequest.isAnonymous() && serviceRequest.isComplaintType(); }
AnonymousComplaintOtpValidator implements ServiceRequestValidator { @Override public boolean canValidate(ServiceRequest serviceRequest) { return serviceRequest.isAnonymous() && serviceRequest.isComplaintType(); } }
AnonymousComplaintOtpValidator implements ServiceRequestValidator { @Override public boolean canValidate(ServiceRequest serviceRequest) { return serviceRequest.isAnonymous() && serviceRequest.isComplaintType(); } AnonymousComplaintOtpValidator(OtpService otpService); }
AnonymousComplaintOtpValidator implements ServiceRequestValidator { @Override public boolean canValidate(ServiceRequest serviceRequest) { return serviceRequest.isAnonymous() && serviceRequest.isComplaintType(); } AnonymousComplaintOtpValidator(OtpService otpService); @Override boolean canValidate(ServiceRequest serviceRequest); @Override void validate(ServiceRequest serviceRequest); }
AnonymousComplaintOtpValidator implements ServiceRequestValidator { @Override public boolean canValidate(ServiceRequest serviceRequest) { return serviceRequest.isAnonymous() && serviceRequest.isComplaintType(); } AnonymousComplaintOtpValidator(OtpService otpService); @Override boolean canValidate(ServiceRequest serviceRequest); @Override void validate(ServiceRequest serviceRequest);  }