ユニットテスト
MyBatis-Plus のテストに必要な関連設定を自動的に導入し、@MybatisPlusTest
アノテーションを使用してテストクラスを素早く設定できます。
サンプルプロジェクト
mybatis-plus-boot-starter-test MyBatis-Plus クイックテスト機能関連コード
使用方法
-
テスト依存性を追加
-
テストケースを記述
import org.junit.jupiter.api.Test;import org.springframework.beans.factory.annotation.Autowired;import static org.assertj.core.api.Assertions.assertThat;@MybatisPlusTestclass MybatisPlusSampleTest {@Autowiredprivate SampleMapper sampleMapper;@Testvoid testInsert() {Sample sample = new Sample();sampleMapper.insert(sample);assertThat(sample.getId()).isNotNull();}}