diff --git a/mateclaw-server/src/test/java/vip/mate/system/service/SystemSettingBoolApiTest.java b/mateclaw-server/src/test/java/vip/mate/system/service/SystemSettingBoolApiTest.java index f79f34d3..77e752e3 100644 --- a/mateclaw-server/src/test/java/vip/mate/system/service/SystemSettingBoolApiTest.java +++ b/mateclaw-server/src/test/java/vip/mate/system/service/SystemSettingBoolApiTest.java @@ -1,8 +1,8 @@ package vip.mate.system.service; +import com.baomidou.mybatisplus.core.MybatisConfiguration; import com.baomidou.mybatisplus.core.metadata.TableInfoHelper; import org.apache.ibatis.builder.MapperBuilderAssistant; -import org.apache.ibatis.session.Configuration; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -40,8 +40,14 @@ class SystemSettingBoolApiTest { @BeforeAll static void initTableInfo() { + // MybatisConfiguration, not the plain MyBatis Configuration: the column + // cache TableInfoHelper installs is static and JVM-wide, and a plain + // Configuration maps properties to camelCase columns (settingKey rather + // than setting_key). Seeding it that way poisons every later query on + // this entity in the same surefire fork, including ones issued through + // a Spring context. TableInfoHelper.initTableInfo( - new MapperBuilderAssistant(new Configuration(), ""), + new MapperBuilderAssistant(new MybatisConfiguration(), ""), SystemSettingEntity.class); } diff --git a/mateclaw-server/src/test/java/vip/mate/system/service/SystemSettingServiceCatalogTest.java b/mateclaw-server/src/test/java/vip/mate/system/service/SystemSettingServiceCatalogTest.java index 25079662..25eb92e9 100644 --- a/mateclaw-server/src/test/java/vip/mate/system/service/SystemSettingServiceCatalogTest.java +++ b/mateclaw-server/src/test/java/vip/mate/system/service/SystemSettingServiceCatalogTest.java @@ -1,8 +1,8 @@ package vip.mate.system.service; +import com.baomidou.mybatisplus.core.MybatisConfiguration; import com.baomidou.mybatisplus.core.metadata.TableInfoHelper; import org.apache.ibatis.builder.MapperBuilderAssistant; -import org.apache.ibatis.session.Configuration; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayName; @@ -44,8 +44,14 @@ class SystemSettingServiceCatalogTest { @BeforeAll static void initTableInfo() { + // MybatisConfiguration, not the plain MyBatis Configuration: the column + // cache TableInfoHelper installs is static and JVM-wide, and a plain + // Configuration maps properties to camelCase columns (settingKey rather + // than setting_key). Seeding it that way poisons every later query on + // this entity in the same surefire fork, including ones issued through + // a Spring context. TableInfoHelper.initTableInfo( - new MapperBuilderAssistant(new Configuration(), ""), + new MapperBuilderAssistant(new MybatisConfiguration(), ""), SystemSettingEntity.class); } diff --git a/mateclaw-server/src/test/java/vip/mate/system/service/SystemSettingWorkspaceStorageRootTest.java b/mateclaw-server/src/test/java/vip/mate/system/service/SystemSettingWorkspaceStorageRootTest.java index cc789a6d..e75d479a 100644 --- a/mateclaw-server/src/test/java/vip/mate/system/service/SystemSettingWorkspaceStorageRootTest.java +++ b/mateclaw-server/src/test/java/vip/mate/system/service/SystemSettingWorkspaceStorageRootTest.java @@ -1,8 +1,8 @@ package vip.mate.system.service; +import com.baomidou.mybatisplus.core.MybatisConfiguration; import com.baomidou.mybatisplus.core.metadata.TableInfoHelper; import org.apache.ibatis.builder.MapperBuilderAssistant; -import org.apache.ibatis.session.Configuration; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; @@ -56,8 +56,14 @@ class SystemSettingWorkspaceStorageRootTest { @BeforeAll static void initTableInfo() { + // MybatisConfiguration, not the plain MyBatis Configuration: the column + // cache TableInfoHelper installs is static and JVM-wide, and a plain + // Configuration maps properties to camelCase columns (settingKey rather + // than setting_key). Seeding it that way poisons every later query on + // this entity in the same surefire fork, including ones issued through + // a Spring context. TableInfoHelper.initTableInfo( - new MapperBuilderAssistant(new Configuration(), ""), + new MapperBuilderAssistant(new MybatisConfiguration(), ""), SystemSettingEntity.class); }