This is an automated email from the ASF dual-hosted git repository.
zhaojinchao 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 9f64ef30312 Refactor PluginConfigurationLoaderTest (#23384)
9f64ef30312 is described below
commit 9f64ef30312b71e7d797a4d8d45199ae1743f4b1
Author: Liang Zhang <[email protected]>
AuthorDate: Sat Jan 7 01:07:16 2023 +0800
Refactor PluginConfigurationLoaderTest (#23384)
* Refactor PluginConfigurationLoaderTest
* Refactor PluginConfigurationLoaderTest
---
.../yaml/plugin/loader/PluginConfigurationLoaderTest.java | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git
a/agent/core/src/test/java/org/apache/shardingsphere/agent/core/plugin/yaml/plugin/loader/PluginConfigurationLoaderTest.java
b/agent/core/src/test/java/org/apache/shardingsphere/agent/core/plugin/yaml/plugin/loader/PluginConfigurationLoaderTest.java
index 62fbf578f33..8bc3a28cf54 100644
---
a/agent/core/src/test/java/org/apache/shardingsphere/agent/core/plugin/yaml/plugin/loader/PluginConfigurationLoaderTest.java
+++
b/agent/core/src/test/java/org/apache/shardingsphere/agent/core/plugin/yaml/plugin/loader/PluginConfigurationLoaderTest.java
@@ -22,22 +22,19 @@ import org.junit.Test;
import java.io.File;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
-import java.net.URL;
import java.net.URLDecoder;
+import java.util.Objects;
import static org.junit.Assert.assertNotNull;
public final class PluginConfigurationLoaderTest {
- private static final String DEFAULT_CONFIG_PATH = "/conf/agent.yaml";
-
@Test
public void assertLoad() throws IOException {
- assertNotNull(PluginConfigurationLoader.load(new
File(getResourceUrl())));
+ assertNotNull(PluginConfigurationLoader.load(new
File(getResourceURL())));
}
- private String getResourceUrl() throws UnsupportedEncodingException {
- URL url =
PluginConfigurationLoader.class.getClassLoader().getResource("");
- return null == url ? DEFAULT_CONFIG_PATH :
URLDecoder.decode(url.getFile(), "UTF8");
+ private String getResourceURL() throws UnsupportedEncodingException {
+ return
URLDecoder.decode(Objects.requireNonNull(PluginConfigurationLoader.class.getClassLoader().getResource("")).getFile(),
"UTF8");
}
}