리뷰어
BiFunction
대신 BiPredicate
을 사용해보자
BiPredicate<Integer, Boolean>
MISS(0, 0, (matchCount, isBonusMatched) -> matchCount <= 2),
FIFTH(3, 5_000, (matchCount, isBonusMatched) -> matchCount == 3),
FOURTH(4, 50_000, (matchCount, isBonusMatched) -> matchCount == 4),
THIRD(5, 1_500_000, (matchCount, isBonusMatched) -> matchCount == 5 && !isBonusMatched),
SECOND(5, 30_000_000, (matchCount, isBonusMatched) -> matchCount == 5 && isBonusMatched),
FIRST(6, 2_000_000_000, (matchCount, isBonusMatched) -> matchCount == 6);
private final int matchCount;
private final int winningMoney;
private final BiPredicate<Integer, Boolean> findCondition;
...
private static boolean checkRankFindCondition(Rank rank, int matchCount, boolean isBonusMatched) {
return rank.findCondition
.test(matchCount, isBonusMatched);
}
리뷰어
긴밀하게 협력하는 객체를 묶어 새로운 도메인을 모델을 도출할 수 있다.
리뷰어
생성자를 이용하면 테스트 코드에서 사용할 인스턴스를 좀 더 쉽게 만들 수 있다.
나
지난번에도 피드백 받았던 내용이어서 아쉬운 부분이었습니다🥲
리뷰어
테스트 코드에서도 중복 메서드를 추상 클래스 등을 활용하여 줄일 수 있다. (저의 경우 유틸리티 클래스를 이용하여 중복을 제거하였습니다.)