Mockito 소개
- Mock: 진짜 객체와 비슷하게 동작하지만 프로그래머가 직접 그 객체의 행동을 관리하는 객체.
- Mockito: Mock 객체를 쉽게 만들고 관리하고 검증할 수 있는 방법을 제공한다.
- https://site.mockito.org/
Mockito framework site
Intro Why How More Who Links Training Why drink it? Mockito is a mocking framework that tastes really good. It lets you write beautiful tests with a clean & simple API. Mockito doesn’t give you hangover because the tests are very readable and they produc
site.mockito.org
- 단위 테스트에 고찰 - https://martinfowler.com/bliki/UnitTest.html
bliki: UnitTest
Unit Tests are focused on small parts of a code-base, defined in regular programming tools, and fast. There is disagreement on whether units should be solitary or sociable.
martinfowler.com
Mockito 시작하기
- 스프링 부트 2.2+ 프로젝트 생성 시 spring-boot-starter-test에서 자동으로 Mockito 추가해 줌.

- core = Mockito 기본 기능 제공
- junit-jupiter = JUnit에서 Mockito를 사용 가능하도록 도와주는 확장팩
- 다음 세 가지만 알면 Mock을 활용한 테스트를 쉽게 작성할 수 있다.
- Mock을 만드는 방법
- Mock이 어떻게 동작해야 하는지 관리하는 방법
- Mock의 행동을 검증하는 방법
- Mockito 레퍼런스 - https://javadoc.io/doc/org.mockito/mockito-core/latest/org/mockito/Mockito.html
Mockito - mockito-core 5.2.0 javadoc
Latest version of org.mockito:mockito-core https://javadoc.io/doc/org.mockito/mockito-core Current version 5.2.0 https://javadoc.io/doc/org.mockito/mockito-core/5.2.0 package-list path (used for javadoc generation -link option) https://javadoc.io/doc/org.m
javadoc.io
'더 자바, 애플리케이션을 테스트하는 다양한 방법' 카테고리의 다른 글
| Ch02. Mockito - Mock 객체 Stubbing (0) | 2022.01.05 |
|---|---|
| Ch02. Mockito - Mock 객체 만들기 (0) | 2022.01.05 |
| Ch01. JUnit5 - JUnit5 마이그레이션 (0) | 2022.01.04 |
| Ch01. JUnit5 - JUnit5 확장 모델 (0) | 2022.01.04 |
| Ch01. JUnit5 - JUnit5 junit-platform.properties (0) | 2022.01.04 |