system微服务util单元测试完善

This commit is contained in:
gaoqr
2025-12-12 16:06:34 +08:00
parent 26cfc538ae
commit 1487296686
12 changed files with 92 additions and 96 deletions
@@ -14,6 +14,9 @@ import java.util.concurrent.ConcurrentHashMap;
* @since 2025/11/12 13:38
*/
public class DictDataI18nCacheUtils {
private DictDataI18nCacheUtils() {
}
private static final Map<String, List<DictDataSimpleRespVO>> CACHE = new ConcurrentHashMap<>();
/**
@@ -11,6 +11,8 @@ import java.util.Locale;
* @since 2025/11/11 15:15
*/
public class LocaleUtils {
private LocaleUtils() {
}
/**
* 获取当前语言,中文就默认null
@@ -20,10 +22,6 @@ public class LocaleUtils {
public static String getLocale() {
Locale locale = LocaleContextHolder.getLocale();
if (locale == null) {
return null;
}
if (Locale.CHINESE.equals(locale)) {
return null;
}
@@ -16,7 +16,8 @@ import java.util.*;
* @author 晨丰科技
*/
public class OAuth2Utils {
private OAuth2Utils() {
}
private static final String FIELD_STATE = "state";
@@ -55,8 +56,8 @@ public class OAuth2Utils {
*/
public static String buildImplicitRedirectUri(String redirectUri, String accessToken, String state, LocalDateTime expireTime,
Collection<String> scopes, Map<String, Object> additionalInformation) {
Map<String, Object> vars = new LinkedHashMap<String, Object>();
Map<String, String> keys = new HashMap<String, String>();
Map<String, Object> vars = new LinkedHashMap<>();
Map<String, String> keys = new HashMap<>();
vars.put("access_token", accessToken);
vars.put("token_type", SecurityFrameworkUtils.AUTHORIZATION_BEARER.toLowerCase());
if (state != null) {
@@ -83,7 +84,7 @@ public class OAuth2Utils {
public static String buildUnsuccessfulRedirect(String redirectUri, String responseType, String state,
String error, String description) {
Map<String, String> query = new LinkedHashMap<String, String>();
Map<String, String> query = new LinkedHashMap<>();
query.put("error", error);
query.put("error_description", description);
if (state != null) {
@@ -11,6 +11,8 @@ import java.util.Objects;
* @since 2024/9/10 15:59
*/
public class OrganUtils {
private OrganUtils() {
}
/**
* 是否内置角色
@@ -15,6 +15,8 @@ import java.util.LinkedList;
*/
public class AsymmetricAlgorithmUtil {
private AsymmetricAlgorithmUtil() {
}
/**
* 公钥加密(解密就要用到对应的私钥)
@@ -80,23 +82,5 @@ public class AsymmetricAlgorithmUtil {
return keys;
}
// public static void main(String[] args) {
//
// LinkedList<String> priKeyAndPubKey = AsymmetricAlgorithmUtil.getPriKeyAndPubKey();
// String privateKey = priKeyAndPubKey.get(0);
// String publicKey = priKeyAndPubKey.get(1);
// String text = "HelloWorld";
//
// String encryptByPublic = AsymmetricAlgorithmUtil.encryptByPublic(text, publicKey);
// System.out.println(encryptByPublic);
// String s = AsymmetricAlgorithmUtil.decryptByPrivate(encryptByPublic, privateKey);
// System.out.println("公钥加密私钥解密:"+s);
//
// String encryptByPrivate = AsymmetricAlgorithmUtil.encryptByPrivate(text, privateKey);
// System.out.println(encryptByPrivate);
// String s1 = AsymmetricAlgorithmUtil.decryptByPublic(encryptByPrivate,publicKey);
// System.out.println("私钥加密公钥解密:"+s1);
// }
}
@@ -10,18 +10,18 @@ import static org.junit.jupiter.api.Assertions.*;
/**
* {@link SimpleTrie} 的单元测试
*/
public class SimpleTrieTest {
class SimpleTrieTest {
private SimpleTrie simpleTrie;
@BeforeEach
public void setUp() {
void setUp() {
List<String> sensitiveWords = Arrays.asList("敏感词", "测试", "ABC", "暴力", "暴力行为");
simpleTrie = new SimpleTrie(sensitiveWords);
}
@Test
public void testConstructorWithEmptyCollection() {
void testConstructorWithEmptyCollection() {
// 测试空集合构造
SimpleTrie trie = new SimpleTrie(Collections.emptyList());
assertTrue(trie.isValid("任何文本"));
@@ -29,7 +29,7 @@ public class SimpleTrieTest {
}
@Test
public void testIsValidWithValidText() {
void testIsValidWithValidText() {
// 测试不包含敏感词的文本
assertTrue(simpleTrie.isValid("这是一段正常的文本"));
assertTrue(simpleTrie.isValid(""));
@@ -37,7 +37,7 @@ public class SimpleTrieTest {
}
@Test
public void testIsValidWithInvalidText() {
void testIsValidWithInvalidText() {
// 测试包含敏感词的文本
assertFalse(simpleTrie.isValid("这段文本包含敏感词"));
assertFalse(simpleTrie.isValid("测试文本"));
@@ -46,7 +46,7 @@ public class SimpleTrieTest {
}
@Test
public void testIsValidWithPartialMatch() {
void testIsValidWithPartialMatch() {
// 测试部分匹配的情况
assertTrue(simpleTrie.isValid("敏感情")); // "敏感情"不包含敏感词"敏感词"
assertTrue(simpleTrie.isValid("测验")); // "测验"不包含敏感词"测试"
@@ -55,7 +55,7 @@ public class SimpleTrieTest {
}
@Test
public void testValidateWithValidText() {
void testValidateWithValidText() {
// 测试不包含敏感词的文本
List<String> result = simpleTrie.validate("这是一段正常的文本");
assertTrue(result.isEmpty());
@@ -68,7 +68,7 @@ public class SimpleTrieTest {
}
@Test
public void testValidateWithSingleSensitiveWord() {
void testValidateWithSingleSensitiveWord() {
// 测试包含单个敏感词的文本
List<String> result = simpleTrie.validate("这段文本包含敏感词");
assertEquals(1, result.size());
@@ -84,7 +84,7 @@ public class SimpleTrieTest {
}
@Test
public void testValidateWithMultipleSensitiveWords() {
void testValidateWithMultipleSensitiveWords() {
// 测试包含多个敏感词的文本
List<String> result = simpleTrie.validate("这段文本包含敏感词和测试内容");
assertEquals(2, result.size());
@@ -93,7 +93,7 @@ public class SimpleTrieTest {
}
@Test
public void testValidateWithOverlappingSensitiveWords() {
void testValidateWithOverlappingSensitiveWords() {
// 测试包含重叠敏感词的文本(最短匹配原则)
List<String> result = simpleTrie.validate("暴力行为测试");
assertEquals(2, result.size());
@@ -105,7 +105,7 @@ public class SimpleTrieTest {
}
@Test
public void testValidateWithRepeatedSensitiveWords() {
void testValidateWithRepeatedSensitiveWords() {
// 测试重复敏感词的情况
List<String> result = simpleTrie.validate("测试测试测试");
assertEquals(1, result.size()); // 应该去重
@@ -113,7 +113,7 @@ public class SimpleTrieTest {
}
@Test
public void testShortestMatchPrinciple() {
void testShortestMatchPrinciple() {
// 测试最短匹配原则
List<String> words = Arrays.asList("煞笔", "煞笔二货");
SimpleTrie trie = new SimpleTrie(words);
@@ -125,7 +125,7 @@ public class SimpleTrieTest {
}
@Test
public void testPrefixOptimization() {
void testPrefixOptimization() {
// 测试前缀优化:如果已有较短敏感词,不应再添加更长的以相同前缀开始的词
List<String> words = Arrays.asList("吃饭", "吃饭啊");
SimpleTrie trie = new SimpleTrie(words);
@@ -142,7 +142,7 @@ public class SimpleTrieTest {
}
@Test
public void testRecursionEndCondition() {
void testRecursionEndCondition() {
// 测试递归结束条件:到达文本末尾
List<String> words = Arrays.asList("a");
SimpleTrie trie = new SimpleTrie(words);
@@ -154,7 +154,7 @@ public class SimpleTrieTest {
}
@Test
public void testRecursionEndAtTextEnd() {
void testRecursionEndAtTextEnd() {
// 测试递归结束条件:到达文本末尾且未匹配到敏感词
List<String> words = Arrays.asList("ab");
SimpleTrie trie = new SimpleTrie(words);
@@ -168,7 +168,7 @@ public class SimpleTrieTest {
}
@Test
public void testSpecialCharacters() {
void testSpecialCharacters() {
// 测试特殊字符
List<String> words = Arrays.asList("特殊$符号", "换行\n符", "制表\t符");
SimpleTrie trie = new SimpleTrie(words);
@@ -185,7 +185,7 @@ public class SimpleTrieTest {
}
@Test
public void testUnicodeCharacters() {
void testUnicodeCharacters() {
// 测试Unicode字符
List<String> words = Arrays.asList("中文", "English", "数字123", "表情😀");
SimpleTrie trie = new SimpleTrie(words);
@@ -204,7 +204,7 @@ public class SimpleTrieTest {
}
@Test
public void testValidateWithoutSensitiveWords() {
void testValidateWithoutSensitiveWords() {
// 测试没有敏感词的情况,覆盖validate方法中!ok为false的分支
List<String> result = simpleTrie.validate("正常文本内容");
assertTrue(result.isEmpty());
@@ -12,22 +12,22 @@ import static org.junit.jupiter.api.Assertions.*;
/**
* {@link DictDataI18nCacheUtils} 的单元测试
*/
public class DictDataI18nCacheUtilsTest {
class DictDataI18nCacheUtilsTest {
@BeforeEach
public void setUp() {
void setUp() {
// 测试前清理缓存
DictDataI18nCacheUtils.clearCache();
}
@AfterEach
public void tearDown() {
void tearDown() {
// 测试后清理缓存
DictDataI18nCacheUtils.clearCache();
}
@Test
public void testPutCacheAndGetCache() {
void testPutCacheAndGetCache() {
// 准备测试数据
Map<String, List<DictDataSimpleRespVO>> testData = new HashMap<>();
List<DictDataSimpleRespVO> dataList = new ArrayList<>();
@@ -53,7 +53,7 @@ public class DictDataI18nCacheUtilsTest {
}
@Test
public void testGetCacheReturnsUnmodifiableMap() {
void testGetCacheReturnsUnmodifiableMap() {
// 准备测试数据
Map<String, List<DictDataSimpleRespVO>> testData = new HashMap<>();
List<DictDataSimpleRespVO> dataList = new ArrayList<>();
@@ -77,7 +77,7 @@ public class DictDataI18nCacheUtilsTest {
}
@Test
public void testClearCache() {
void testClearCache() {
// 准备测试数据
Map<String, List<DictDataSimpleRespVO>> testData = new HashMap<>();
List<DictDataSimpleRespVO> dataList = new ArrayList<>();
@@ -104,7 +104,7 @@ public class DictDataI18nCacheUtilsTest {
}
@Test
public void testPutCacheMultipleTimes() {
void testPutCacheMultipleTimes() {
// 测试多次添加缓存数据
Map<String, List<DictDataSimpleRespVO>> testData1 = new HashMap<>();
List<DictDataSimpleRespVO> dataList1 = new ArrayList<>();
@@ -136,7 +136,7 @@ public class DictDataI18nCacheUtilsTest {
}
@Test
public void testGetCacheWhenEmpty() {
void testGetCacheWhenEmpty() {
// 测试缓存为空时的情况
Map<String, List<DictDataSimpleRespVO>> cache = DictDataI18nCacheUtils.getCache();
assertNotNull(cache);
@@ -14,18 +14,18 @@ import static org.mockito.Mockito.*;
/**
* {@link LocaleUtils} 的单元测试
*/
public class LocaleUtilsTest {
class LocaleUtilsTest {
private MockedStatic<LocaleContextHolder> mockedLocaleContextHolder;
@BeforeEach
public void setUp() {
void setUp() {
// Mock静态类LocaleContextHolder
mockedLocaleContextHolder = mockStatic(LocaleContextHolder.class);
}
@AfterEach
public void tearDown() {
void tearDown() {
// 关闭静态mock
if (mockedLocaleContextHolder != null) {
mockedLocaleContextHolder.close();
@@ -33,7 +33,7 @@ public class LocaleUtilsTest {
}
@Test
public void testGetLocaleWhenLocaleIsNull() {
void testGetLocaleWhenLocaleIsNull() {
// 模拟getLocale返回null
mockedLocaleContextHolder.when(LocaleContextHolder::getLocale).thenReturn(null);
@@ -43,7 +43,7 @@ public class LocaleUtilsTest {
}
@Test
public void testGetLocaleWhenLocaleIsChinese() {
void testGetLocaleWhenLocaleIsChinese() {
// 模拟getLocale返回中文环境
mockedLocaleContextHolder.when(LocaleContextHolder::getLocale).thenReturn(Locale.CHINESE);
@@ -53,7 +53,7 @@ public class LocaleUtilsTest {
}
@Test
public void testGetLocaleWhenLocaleIsChineseVariant() {
void testGetLocaleWhenLocaleIsChineseVariant() {
// 模拟getLocale返回中文环境变体
mockedLocaleContextHolder.when(LocaleContextHolder::getLocale).thenReturn(Locale.SIMPLIFIED_CHINESE);
@@ -63,7 +63,7 @@ public class LocaleUtilsTest {
}
@Test
public void testGetLocaleWhenLocaleIsEnglish() {
void testGetLocaleWhenLocaleIsEnglish() {
// 模拟getLocale返回英文环境
mockedLocaleContextHolder.when(LocaleContextHolder::getLocale).thenReturn(Locale.ENGLISH);
@@ -73,7 +73,7 @@ public class LocaleUtilsTest {
}
@Test
public void testGetLocaleWhenLocaleIsFrench() {
void testGetLocaleWhenLocaleIsFrench() {
// 模拟getLocale返回法文环境
mockedLocaleContextHolder.when(LocaleContextHolder::getLocale).thenReturn(Locale.FRENCH);
@@ -83,7 +83,7 @@ public class LocaleUtilsTest {
}
@Test
public void testGetLocaleWhenLocaleIsGerman() {
void testGetLocaleWhenLocaleIsGerman() {
// 模拟getLocale返回德文环境
mockedLocaleContextHolder.when(LocaleContextHolder::getLocale).thenReturn(Locale.GERMAN);
@@ -93,7 +93,7 @@ public class LocaleUtilsTest {
}
@Test
public void testGetLocaleWhenLocaleIsJapan() {
void testGetLocaleWhenLocaleIsJapan() {
// 模拟getLocale返回日文环境
mockedLocaleContextHolder.when(LocaleContextHolder::getLocale).thenReturn(Locale.JAPANESE);
@@ -10,10 +10,10 @@ import static org.junit.jupiter.api.Assertions.*;
/**
* {@link OAuth2Utils} 的单元测试
*/
public class OAuth2UtilsTest {
class OAuth2UtilsTest {
@Test
public void testBuildAuthorizationCodeRedirectUri() {
void testBuildAuthorizationCodeRedirectUri() {
// 测试构建授权码模式下的重定向URI
String redirectUri = "https://example.com/callback";
String authorizationCode = "auth-code-12345";
@@ -27,7 +27,7 @@ public class OAuth2UtilsTest {
}
@Test
public void testBuildAuthorizationCodeRedirectUriWithoutState() {
void testBuildAuthorizationCodeRedirectUriWithoutState() {
// 测试构建授权码模式下的重定向URI(不包含state参数)
String redirectUri = "https://example.com/callback";
String authorizationCode = "auth-code-12345";
@@ -41,7 +41,7 @@ public class OAuth2UtilsTest {
}
@Test
public void testBuildImplicitRedirectUri() {
void testBuildImplicitRedirectUri() {
// 测试构建简化模式下的重定向URI
String redirectUri = "https://example.com/callback";
String accessToken = "access-token-12345";
@@ -73,7 +73,7 @@ public class OAuth2UtilsTest {
}
@Test
public void testBuildImplicitRedirectUriWithMinimalParameters() {
void testBuildImplicitRedirectUriWithMinimalParameters() {
// 测试构建简化模式下的重定向URI(最小参数)
String redirectUri = "https://example.com/callback";
String accessToken = "access-token-12345";
@@ -93,7 +93,7 @@ public class OAuth2UtilsTest {
}
@Test
public void testBuildUnsuccessfulRedirect() {
void testBuildUnsuccessfulRedirect() {
// 测试构建失败重定向URI
String redirectUri = "https://example.com/callback";
String responseType = "code";
@@ -110,7 +110,7 @@ public class OAuth2UtilsTest {
}
@Test
public void testBuildUnsuccessfulRedirectWithoutState() {
void testBuildUnsuccessfulRedirectWithoutState() {
// 测试构建失败重定向URI(不包含state参数)
String redirectUri = "https://example.com/callback";
String responseType = "token";
@@ -127,7 +127,7 @@ public class OAuth2UtilsTest {
}
@Test
public void testGetExpiresIn() {
void testGetExpiresIn() {
// 测试获取过期时间
LocalDateTime futureTime = LocalDateTime.now().plusSeconds(3600);
@@ -139,7 +139,7 @@ public class OAuth2UtilsTest {
}
@Test
public void testBuildScopeStr() {
void testBuildScopeStr() {
// 测试构建scope字符串
Collection<String> scopes = Arrays.asList("read", "write", "profile");
@@ -149,7 +149,7 @@ public class OAuth2UtilsTest {
}
@Test
public void testBuildScopeStrWithEmptyScopes() {
void testBuildScopeStrWithEmptyScopes() {
// 测试构建scope字符串(空集合)
Collection<String> scopes = new ArrayList<>();
@@ -159,7 +159,7 @@ public class OAuth2UtilsTest {
}
@Test
public void testBuildScopeStrWithNullScopes() {
void testBuildScopeStrWithNullScopes() {
// 测试构建scope字符串(null
Collection<String> scopes = null;
@@ -169,7 +169,7 @@ public class OAuth2UtilsTest {
}
@Test
public void testBuildScopes() {
void testBuildScopes() {
// 测试解析scope字符串
String scope = "read write profile";
@@ -182,7 +182,7 @@ public class OAuth2UtilsTest {
}
@Test
public void testBuildScopesWithSingleScope() {
void testBuildScopesWithSingleScope() {
// 测试解析scope字符串(单个scope)
String scope = "read";
@@ -193,7 +193,7 @@ public class OAuth2UtilsTest {
}
@Test
public void testBuildScopesWithEmptyString() {
void testBuildScopesWithEmptyString() {
// 测试解析scope字符串(空字符串)
String scope = "";
@@ -205,7 +205,7 @@ public class OAuth2UtilsTest {
}
@Test
public void testBuildScopesWithNull() {
void testBuildScopesWithNull() {
// 测试解析scope字符串(null
String scope = null;
@@ -8,10 +8,10 @@ import static org.junit.jupiter.api.Assertions.*;
/**
* {@link OrganUtils} 的单元测试
*/
public class OrganUtilsTest {
class OrganUtilsTest {
@Test
public void testIsOrgRoleWithOrganAdminRoleId() {
void testIsOrgRoleWithOrganAdminRoleId() {
// 测试组织管理员角色ID
Long organAdminRoleId = InternalRoleConstants.ORGAN_ADMIN_ROLE_ID;
boolean result = OrganUtils.isOrgRole(organAdminRoleId);
@@ -19,10 +19,18 @@ public class OrganUtilsTest {
}
@Test
public void testIsOrgRoleWithOrganStaffRoleId() {
void testIsOrgRoleWithOrganStaffRoleId() {
// 测试组织员工角色ID
Long organStaffRoleId = InternalRoleConstants.ORGAN_STAFF_ROLE_ID;
boolean result = OrganUtils.isOrgRole(organStaffRoleId);
assertTrue(result, "组织员工角色ID应该返回true");
}
@Test
void testIsOrgRoleWithOtherRoleId() {
// 测试其他角色ID(两个条件都为false的情况)
Long otherRoleId = 100L;
boolean result = OrganUtils.isOrgRole(otherRoleId);
assertFalse(result, "其他角色ID应该返回false");
}
}
@@ -17,13 +17,13 @@ import static org.junit.jupiter.api.Assertions.*;
*
* 使用 BaseRedisUnitTest 基类,利用真实的 Redis 环境进行测试
*/
public class SystemRedisUtilsTest extends BaseRedisUnitTest {
class SystemRedisUtilsTest extends BaseRedisUnitTest {
@Resource
private StringRedisTemplate stringRedisTemplate;
@Test
public void testScanAndCompareDeptAndDelTokenWithMatchingDeptId() {
void testScanAndCompareDeptAndDelTokenWithMatchingDeptId() {
// 准备测试数据
Long deptId = 100L;
@@ -57,7 +57,7 @@ public class SystemRedisUtilsTest extends BaseRedisUnitTest {
}
@Test
public void testScanAndCompareDeptAndDelTokenWithNoMatchingDeptId() {
void testScanAndCompareDeptAndDelTokenWithNoMatchingDeptId() {
// 准备测试数据
Long deptId = 100L;
@@ -91,7 +91,7 @@ public class SystemRedisUtilsTest extends BaseRedisUnitTest {
}
@Test
public void testScanAndCompareDeptAndDelTokenWithEmptyKeys() {
void testScanAndCompareDeptAndDelTokenWithEmptyKeys() {
// 准备测试数据
Long deptId = 100L;
@@ -9,10 +9,10 @@ import static org.junit.jupiter.api.Assertions.*;
/**
* {@link AsymmetricAlgorithmUtil} 的单元测试
*/
public class AsymmetricAlgorithmUtilTest {
class AsymmetricAlgorithmUtilTest {
@Test
public void testGetPriKeyAndPubKey() {
void testGetPriKeyAndPubKey() {
// 测试获取公私钥集合
LinkedList<String> keys = AsymmetricAlgorithmUtil.getPriKeyAndPubKey();
@@ -24,7 +24,7 @@ public class AsymmetricAlgorithmUtilTest {
}
@Test
public void testEncryptByPublicAndDecryptByPrivate() {
void testEncryptByPublicAndDecryptByPrivate() {
// 测试公钥加密私钥解密
LinkedList<String> keys = AsymmetricAlgorithmUtil.getPriKeyAndPubKey();
String privateKey = keys.get(0);
@@ -42,7 +42,7 @@ public class AsymmetricAlgorithmUtilTest {
}
@Test
public void testEncryptByPrivateAndDecryptByPublic() {
void testEncryptByPrivateAndDecryptByPublic() {
// 测试私钥加密公钥解密
LinkedList<String> keys = AsymmetricAlgorithmUtil.getPriKeyAndPubKey();
String privateKey = keys.get(0);
@@ -60,7 +60,7 @@ public class AsymmetricAlgorithmUtilTest {
}
@Test
public void testEncryptAndDecryptWithEmptyString() {
void testEncryptAndDecryptWithEmptyString() {
// 测试空字符串的加解密
LinkedList<String> keys = AsymmetricAlgorithmUtil.getPriKeyAndPubKey();
String privateKey = keys.get(0);
@@ -77,7 +77,7 @@ public class AsymmetricAlgorithmUtilTest {
}
@Test
public void testEncryptAndDecryptWithSpecialCharacters() {
void testEncryptAndDecryptWithSpecialCharacters() {
// 测试特殊字符的加解密
LinkedList<String> keys = AsymmetricAlgorithmUtil.getPriKeyAndPubKey();
String privateKey = keys.get(0);
@@ -95,7 +95,7 @@ public class AsymmetricAlgorithmUtilTest {
}
@Test
public void testEncryptByPublicWithInvalidKey() {
void testEncryptByPublicWithInvalidKey() {
// 测试使用无效公钥加密
String plainText = "Hello World";
String invalidPublicKey = "invalid-public-key";
@@ -106,7 +106,7 @@ public class AsymmetricAlgorithmUtilTest {
}
@Test
public void testDecryptByPrivateWithInvalidKey() {
void testDecryptByPrivateWithInvalidKey() {
// 测试使用无效私钥解密
String encryptedText = "some-encrypted-text";
String invalidPrivateKey = "invalid-private-key";
@@ -117,7 +117,7 @@ public class AsymmetricAlgorithmUtilTest {
}
@Test
public void testEncryptByPrivateWithInvalidKey() {
void testEncryptByPrivateWithInvalidKey() {
// 测试使用无效私钥加密
String plainText = "Hello World";
String invalidPrivateKey = "invalid-private-key";
@@ -128,7 +128,7 @@ public class AsymmetricAlgorithmUtilTest {
}
@Test
public void testDecryptByPublicWithInvalidKey() {
void testDecryptByPublicWithInvalidKey() {
// 测试使用无效公钥解密
String encryptedText = "some-encrypted-text";
String invalidPublicKey = "invalid-public-key";
@@ -139,7 +139,7 @@ public class AsymmetricAlgorithmUtilTest {
}
@Test
public void testDecryptByPrivateWithWrongKey() {
void testDecryptByPrivateWithWrongKey() {
// 测试使用不匹配的私钥解密
LinkedList<String> keys1 = AsymmetricAlgorithmUtil.getPriKeyAndPubKey();
String publicKey1 = keys1.get(1);
@@ -158,7 +158,7 @@ public class AsymmetricAlgorithmUtilTest {
}
@Test
public void testDecryptByPublicWithWrongKey() {
void testDecryptByPublicWithWrongKey() {
// 测试使用不匹配的公钥解密
LinkedList<String> keys1 = AsymmetricAlgorithmUtil.getPriKeyAndPubKey();
String privateKey1 = keys1.get(0);