Open DolphaGo opened 2 years ago
@Service @RequiredArgsConstructor public class MyService { private final MyMapper mapper; public SecondDto create(final FirstDto dto) { return mapper.map(dto); } }
위와 같은 코드가 있다고 가정하자.
이에 대한 테스트 코드는 다음과 같이 짜면 된다.
... @InjectMocks private MyService myService; @Spy private MyMapper mapper = Mappers.getMapper(MyMapper.class); @DisplayName("변환 테스트") @Test void test() { SecondDto dto = myService.create(new FirstDto()); }
위와 같은 코드가 있다고 가정하자.
이에 대한 테스트 코드는 다음과 같이 짜면 된다.