更新完成:优化微信支付证书读取机制等等

This commit is contained in:
2025-07-27 23:02:59 +08:00
parent e569463c02
commit 803c6344ab
20 changed files with 330 additions and 48 deletions

View File

@@ -0,0 +1,51 @@
package com.gxwebsoft.config;
import com.gxwebsoft.common.core.config.ConfigProperties;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import static org.junit.jupiter.api.Assertions.*;
/**
* 服务器URL配置测试
* 验证server-url配置是否正确从配置文件读取
*/
@SpringBootTest
@ActiveProfiles("dev")
public class ServerUrlConfigTest {
@Autowired
private ConfigProperties configProperties;
@Test
public void testServerUrlConfiguration() {
// 验证配置属性不为空
assertNotNull(configProperties, "ConfigProperties should not be null");
// 验证server-url配置正确读取
String serverUrl = configProperties.getServerUrl();
assertNotNull(serverUrl, "Server URL should not be null");
assertFalse(serverUrl.isEmpty(), "Server URL should not be empty");
// 在开发环境下,应该是本地地址
assertTrue(serverUrl.contains("127.0.0.1") || serverUrl.contains("localhost"),
"In dev environment, server URL should contain localhost or 127.0.0.1");
System.out.println("当前配置的服务器URL: " + serverUrl);
}
@Test
public void testServerUrlFormat() {
String serverUrl = configProperties.getServerUrl();
// 验证URL格式
assertTrue(serverUrl.startsWith("http://") || serverUrl.startsWith("https://"),
"Server URL should start with http:// or https://");
assertTrue(serverUrl.endsWith("/api"),
"Server URL should end with /api");
System.out.println("服务器URL格式验证通过: " + serverUrl);
}
}