Unit Testing
It will automatically import the configurations required for MyBatis-Plus testing. You can quickly configure test classes using the @MybatisPlusTest
annotation.
Sample Project
mybatis-plus-boot-starter-test Source code related to the MyBatis-Plus quick testing feature.
Usage Guide
-
Add Test Dependency
-
Write Test Cases
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();}}