ohhoonim / factory

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[domain/auth/api/service/UserSignupService.java] 입력값 검사 로직에 수정 사항이 있는 것 같습니다.

togetherwelove opened this issue · comments

안녕하세요. 제작해주신 유튜브 영상 너무 잘 보고있습니다.
소스코드를 오픈해주셔서 공부하는 데 정말 큰 도움이 됩니다.
그러나 제공해주신 코드에서 의문점이 드는 부분이 있어서 Issues 남깁니다.
불편하시다면 Comment 달아주시면 삭제하겠습니다.

@Override
    public void checkRequiredItem(UserSignupCommand command) {
        if (ObjectUtils.isEmpty(command) ||
                StringUtils.hasText(command.email()) ||
                StringUtils.hasText(command.password()) ||
                StringUtils.hasText(command.passwordVerify())) {
            throw new RequiredItemException("입력값이 존재하지 않습니다.");
        }
    }

command 객체가 비어 있거나, email, password, passwordVerify 중 하나라도 텍스트를 가지고 있지 않을 때 예외를 발생시키려면 hasText의 결과를 부정하는 ! 연산자가 추가되어야 할 것 같습니다. 감사합니다.

@Override
    public void checkRequiredItem(UserSignupCommand command) {
        if (ObjectUtils.isEmpty(command) ||
                !StringUtils.hasText(command.email()) ||
                !StringUtils.hasText(command.password()) ||
                !StringUtils.hasText(command.passwordVerify())) {
            throw new RequiredItemException("입력값이 존재하지 않습니다.");
        }
    }

이런내용 전혀 불편하지 않습니다. 언제든 올려주세요.
아직 git issue 관리하는법이 익숙하지 않네요. "6-회원가입' 브랜치에 수정하였습니다.
테스트코드도 살짝 수정되었습니다.