charlhhhh opened a new pull request, #7275: URL: https://github.com/apache/incubator-seata/pull/7275
<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <!-- Please make sure you have read and understood the contributing guidelines --> <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <!-- Please make sure you have read and understood the contributing guidelines --> ### Why This PR addresses [#1714](https://github.com/apache/incubator-seata/issues/1714) to improve test coverage for the `seata-rm-datasource` module, particularly the `org.apache.seata.rm` package, which had low method and line coverage. Before: - Package `org.apache.seata.rm`: 42% line coverage - Class `BaseDataSourceResource`: Not explicitly tested After: - Package `org.apache.seata.rm`: 73% line coverage - Improved method and line coverage for `BaseDataSourceResource` ### What - Added targeted unit tests for the abstract class `BaseDataSourceResource` using: - A dummy implementation `DummyHoldable` to simulate holdable resource state. - A subclass `DummyResource` to override abstract methods (e.g., `getConnection`). - Verified behavior of key methods: - `hold()`, `release()`, `lookup()` - Resource-related setters and getters - Branch status cache operations - Mocked required dependencies using `Mockito` and followed Seata’s test structure and style. ### How to Verify Run: ```bash ./mvnw clean test jacoco:report -pl rm ``` Then open the coverage report at: ```bash rm/target/site/jacoco/index.html ``` Note: I have read the [contributing guidelines](https://github.com/apache/seata/blob/develop/CONTRIBUTING.md) and followed the testing structure and code style. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@seata.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@seata.apache.org For additional commands, e-mail: notifications-h...@seata.apache.org