Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/main/java/nextstep/courses/domain/Capacity.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package nextstep.courses.domain;

import java.util.Objects;

public class Capacity {
private final int value;

Expand All @@ -17,4 +19,17 @@ public int getValue() {
public boolean isFull(int registeredCount) {
return registeredCount >= value;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof Capacity)) return false;
Capacity capacity = (Capacity) o;
return value == capacity.value;
}

@Override
public int hashCode() {
return Objects.hash(value);
}
}
15 changes: 15 additions & 0 deletions src/main/java/nextstep/courses/domain/Period.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package nextstep.courses.domain;

import java.time.LocalDate;
import java.util.Objects;

public class Period {
private final LocalDate startDate;
Expand All @@ -21,4 +22,18 @@ public LocalDate getStartDate() {
public LocalDate getEndDate() {
return endDate;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof Period)) return false;
Period period = (Period) o;
return Objects.equals(startDate, period.startDate) &&
Objects.equals(endDate, period.endDate);
}

@Override
public int hashCode() {
return Objects.hash(startDate, endDate);
}
}
14 changes: 14 additions & 0 deletions src/main/java/nextstep/courses/domain/TuitionFee.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package nextstep.courses.domain;

import java.util.Objects;

public class TuitionFee {
private final int amount;

Expand All @@ -12,5 +14,17 @@ public TuitionFee(int amount) {

public int getAmount() {
return amount;

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof TuitionFee)) return false;
TuitionFee that = (TuitionFee) o;
return amount == that.amount;
}

@Override
public int hashCode() {
Comment on lines +23 to +32
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

리뷰 반영 잘 되었네요 😄

return Objects.hash(amount);
}
}