-
Notifications
You must be signed in to change notification settings - Fork 0
Test Code Convention
Hayoung Moon edited this page Jan 25, 2025
·
1 revision
com.example.project
├── controller
│ └── UserController.java
├── service
│ └── UserService.java
│ └── UserServiceImpl.java
├── domain
│ └── User.java
│ └── UserStatus.java
├── infrastructure
│ └── UserJpaRepository.java
│ └── UserEntity.java
│ └── UserRepositoryImpl.java
├── repository
│ └── UserRepository.java
└── dto
└── request
└── response
/test/java/{도메인}/{레이어}
{본인 닉네임/refactor}
-
{본인 닉네임/refactor}
->refactor
로 PR
-
{클래스명}Test
형식
MethodName_ExpectedBehavior_StateUnderTest
isAdult_False_AgeLessThan18
withdrawMoney_ThrowsException_IfAccountIsInvalid
Given-When-Then
given : 테스트 실행을 준비하는 단계
when : 테스트를 진행하는 단계
then : 테스트 결과를 검증하는 단계
- Service, Domain 100% Coverage 목표
- RestTemplate, Uuid 등 의존성 분리
- Service와 ServiceImpl 분리
- DB 엔티티와 객체 엔티티 분리
- JPA Repository와 도메인 Repository 분리