This is an automated email from the ASF dual-hosted git repository.
zhangliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new b7d3589f088 Add more test cases on ResourceMetaData (#36988)
b7d3589f088 is described below
commit b7d3589f088273199911219bc5c92b8c16dadcd1
Author: Liang Zhang <[email protected]>
AuthorDate: Sat Nov 1 23:20:52 2025 +0800
Add more test cases on ResourceMetaData (#36988)
---
.../infra/metadata/database/rule/RuleMetaDataTest.java | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git
a/infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/database/rule/RuleMetaDataTest.java
b/infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/database/rule/RuleMetaDataTest.java
index b3fd2941ba9..2c12e4f8cec 100644
---
a/infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/database/rule/RuleMetaDataTest.java
+++
b/infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/database/rule/RuleMetaDataTest.java
@@ -111,4 +111,17 @@ class RuleMetaDataTest {
assertFalse(ruleMetaData.getAttributes(DataSourceMapperRuleAttribute.class).isEmpty());
assertFalse(ruleMetaData.getAttributes(DataNodeRuleAttribute.class).isEmpty());
}
+
+ @Test
+ void assertFindAttribute() {
+ Optional<DataSourceMapperRuleAttribute> actual =
ruleMetaData.findAttribute(DataSourceMapperRuleAttribute.class);
+ assertTrue(actual.isPresent());
+ assertThat(actual.get(), isA(DataSourceMapperRuleAttribute.class));
+ }
+
+ @Test
+ void assertFindEmptyAttribute() {
+ RuleMetaData metaData = new
RuleMetaData(Collections.singleton(mock(ShardingSphereRule.class,
RETURNS_DEEP_STUBS)));
+
assertFalse(metaData.findAttribute(DataSourceMapperRuleAttribute.class).isPresent());
+ }
}