Skip to content

Commit

Permalink
refactor: toString 재정의 및 검증 로직 분리
Browse files Browse the repository at this point in the history
  • Loading branch information
HyungHoKim00 committed Dec 19, 2024
1 parent ea2380e commit eb60471
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
13 changes: 13 additions & 0 deletions backend/src/main/java/com/cruru/applicant/domain/Evaluation.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,18 @@ private boolean isOutOfRange(int score) {
return score < MIN_SCORE || score > MAX_SCORE;
}

public boolean isEvaluator(String evaluator) {
return this.evaluator.equals(evaluator);
}

public boolean isContent(String content) {
return this.content.equals(content);
}

public boolean isScore(int score) {
return this.score == score;
}

@Override
public boolean isAuthorizedBy(Member member) {
return process.isAuthorizedBy(member);
Expand All @@ -92,6 +104,7 @@ public int hashCode() {
public String toString() {
return "Evaluation{" +
"id=" + id +
", evaluator='" + evaluator + '\'' +
", score=" + score +
", content='" + content + '\'' +
", process=" + process +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ public void update(EvaluationUpdateRequest request, Evaluation evaluation) {

private boolean changeExists(EvaluationUpdateRequest request, Evaluation evaluation) {
return !(
evaluation.getContent().equals(request.content())
&& evaluation.getScore().equals(request.score())
&& evaluation.getEvaluator().equals(request.evaluator())
evaluation.isContent(request.content())
&& evaluation.isScore(request.score())
&& evaluation.isEvaluator(request.evaluator())
);
}

Expand Down

0 comments on commit eb60471

Please sign in to comment.