package com.sino.mci.config;

import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;

class MybatisPlusConfigTest {

    @Test
    void mybatisPlusInterceptorContainsPaginationInnerInterceptor() {
        MybatisPlusConfig config = new MybatisPlusConfig();
        MybatisPlusInterceptor interceptor = config.mybatisPlusInterceptor();

        assertNotNull(interceptor);
        assertTrue(
                interceptor.getInterceptors().stream().anyMatch(i -> i instanceof PaginationInnerInterceptor),
                "MybatisPlusInterceptor should contain PaginationInnerInterceptor"
        );
    }
}
