@Test(expected = IllegalArgumentException.class) public void isValidExistingCandidateShouldThrowIllegalArgumentExceptionWhenCandidateIsNull() { this.candidateValidatorHelper.isValidExistingCandidate(null); }
public boolean isValidExistingCandidate(CandidateDTO candidateDTO) { this.preValidateExistingCandidate(candidateDTO); Long candidateId = candidateDTO.getId(); CandidateDTO candidateDTOByEmail = this.candidateService.getCandidateDtoByEmail(candidateDTO.getEmail()); CandidateDTO candidateDTOByPhone = this.candidateService.getCandidateDtoByPhone(candidateDTO.getPhone()); if ((candidateDTOByEmail == null || candidateDTOByEmail.getId().equals(candidateId)) && (candidateDTOByPhone == null || candidateDTOByPhone.getId().equals(candidateId))) { return true; } return false; }
CandidateValidatorHelper { public boolean isValidExistingCandidate(CandidateDTO candidateDTO) { this.preValidateExistingCandidate(candidateDTO); Long candidateId = candidateDTO.getId(); CandidateDTO candidateDTOByEmail = this.candidateService.getCandidateDtoByEmail(candidateDTO.getEmail()); CandidateDTO candidateDTOByPhone = this.candidateService.getCandidateDtoByPhone(candidateDTO.getPhone()); if ((candidateDTOByEmail == null || candidateDTOByEmail.getId().equals(candidateId)) && (candidateDTOByPhone == null || candidateDTOByPhone.getId().equals(candidateId))) { return true; } return false; } }
CandidateValidatorHelper { public boolean isValidExistingCandidate(CandidateDTO candidateDTO) { this.preValidateExistingCandidate(candidateDTO); Long candidateId = candidateDTO.getId(); CandidateDTO candidateDTOByEmail = this.candidateService.getCandidateDtoByEmail(candidateDTO.getEmail()); CandidateDTO candidateDTOByPhone = this.candidateService.getCandidateDtoByPhone(candidateDTO.getPhone()); if ((candidateDTOByEmail == null || candidateDTOByEmail.getId().equals(candidateId)) && (candidateDTOByPhone == null || candidateDTOByPhone.getId().equals(candidateId))) { return true; } return false; }  }
CandidateValidatorHelper { public boolean isValidExistingCandidate(CandidateDTO candidateDTO) { this.preValidateExistingCandidate(candidateDTO); Long candidateId = candidateDTO.getId(); CandidateDTO candidateDTOByEmail = this.candidateService.getCandidateDtoByEmail(candidateDTO.getEmail()); CandidateDTO candidateDTOByPhone = this.candidateService.getCandidateDtoByPhone(candidateDTO.getPhone()); if ((candidateDTOByEmail == null || candidateDTOByEmail.getId().equals(candidateId)) && (candidateDTOByPhone == null || candidateDTOByPhone.getId().equals(candidateId))) { return true; } return false; }  boolean isValidNonExistingCandidate(CandidateDTO candidateDTO); boolean isValidExistingCandidate(CandidateDTO candidateDTO); }
CandidateValidatorHelper { public boolean isValidExistingCandidate(CandidateDTO candidateDTO) { this.preValidateExistingCandidate(candidateDTO); Long candidateId = candidateDTO.getId(); CandidateDTO candidateDTOByEmail = this.candidateService.getCandidateDtoByEmail(candidateDTO.getEmail()); CandidateDTO candidateDTOByPhone = this.candidateService.getCandidateDtoByPhone(candidateDTO.getPhone()); if ((candidateDTOByEmail == null || candidateDTOByEmail.getId().equals(candidateId)) && (candidateDTOByPhone == null || candidateDTOByPhone.getId().equals(candidateId))) { return true; } return false; }  boolean isValidNonExistingCandidate(CandidateDTO candidateDTO); boolean isValidExistingCandidate(CandidateDTO candidateDTO);  }