This is an automated email from the ASF dual-hosted git repository.
terrymanu 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 738f4a578e4 Refactor BootstrapInitializerTest (#39010)
738f4a578e4 is described below
commit 738f4a578e4d12dd3cd021d06923e7bf18ed3b4b
Author: Liang Zhang <[email protected]>
AuthorDate: Sun Jul 5 21:32:15 2026 +0800
Refactor BootstrapInitializerTest (#39010)
---
.../proxy/initializer/BootstrapInitializerTest.java | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git
a/proxy/bootstrap/src/test/java/org/apache/shardingsphere/proxy/initializer/BootstrapInitializerTest.java
b/proxy/bootstrap/src/test/java/org/apache/shardingsphere/proxy/initializer/BootstrapInitializerTest.java
index fd513c3c804..666a625e812 100644
---
a/proxy/bootstrap/src/test/java/org/apache/shardingsphere/proxy/initializer/BootstrapInitializerTest.java
+++
b/proxy/bootstrap/src/test/java/org/apache/shardingsphere/proxy/initializer/BootstrapInitializerTest.java
@@ -17,6 +17,7 @@
package org.apache.shardingsphere.proxy.initializer;
+import lombok.SneakyThrows;
import org.apache.shardingsphere.infra.config.mode.ModeConfiguration;
import org.apache.shardingsphere.infra.instance.metadata.InstanceMetaData;
import
org.apache.shardingsphere.infra.instance.metadata.InstanceMetaDataBuilder;
@@ -79,7 +80,7 @@ class BootstrapInitializerTest {
}
@Test
- void assertInitWithoutModeConfiguration() throws SQLException,
ReflectiveOperationException {
+ void assertInitWithoutModeConfiguration() throws SQLException {
InstanceMetaDataBuilder instanceMetaDataBuilder =
mock(InstanceMetaDataBuilder.class);
InstanceMetaData instanceMetaData = mock(InstanceMetaData.class);
registerSingletonService(InstanceMetaDataBuilder.class,
instanceMetaDataBuilder);
@@ -104,7 +105,7 @@ class BootstrapInitializerTest {
}
@Test
- void assertInitWithModeConfiguration() throws SQLException,
ReflectiveOperationException {
+ void assertInitWithModeConfiguration() throws SQLException {
YamlModeConfiguration yamlModeConfig = new YamlModeConfiguration();
yamlModeConfig.setType("Cluster");
InstanceMetaDataBuilder instanceMetaDataBuilder =
mock(InstanceMetaDataBuilder.class);
@@ -131,7 +132,7 @@ class BootstrapInitializerTest {
}
@Test
- void assertInitWithRepeatedBootstrap() throws SQLException,
ReflectiveOperationException {
+ void assertInitWithRepeatedBootstrap() throws SQLException {
InstanceMetaDataBuilder instanceMetaDataBuilder =
mock(InstanceMetaDataBuilder.class);
InstanceMetaData instanceMetaData = mock(InstanceMetaData.class);
registerSingletonService(InstanceMetaDataBuilder.class,
instanceMetaDataBuilder);
@@ -156,7 +157,8 @@ class BootstrapInitializerTest {
}
@SuppressWarnings("unchecked")
- private <T> void registerSingletonService(final Class<T> serviceClass,
final T serviceInstance) throws ReflectiveOperationException {
+ @SneakyThrows(ReflectiveOperationException.class)
+ private <T> void registerSingletonService(final Class<T> serviceClass,
final T serviceInstance) {
MemberAccessor accessor = Plugins.getMemberAccessor();
Field servicesField =
ShardingSphereServiceLoader.class.getDeclaredField("REGISTERED_SERVICES");
Map<Class<?>, Object> registeredServices = (Map<Class<?>, Object>)
accessor.get(servicesField, null);