`
@ExtendWith(MockitoExtension.class)
class XxxxTeset {
@InjectMocks
private XxxService service = new XxxService();
@Mock
private XxxMapper xxxMapper;
@Mock
private XxxDao xxxDao;
@BeforeEach
public void initTable() {
TableInfoHelper.initTableInfo(new MapperBuilderAssistent(new MybatisConfiguration(), ""), // Mapper中的Bean对象);
//若是 MPJLambdaWrapper 连接多少张表就需要写多少个Bean对象的
// 否则报错 can not find lambda cache
}
@Test
void test() {
// 若是模拟 MybatisPlus中的ServiceImpl中getBaseMapper需要
Mockito.when(xxxDao.getBaseMapper()).thenReturn(xxx);
}
`