完善单元测试

This commit is contained in:
click33
2022-09-01 18:15:38 +08:00
parent cb97d05834
commit 285dacf06c
5 changed files with 163 additions and 22 deletions

View File

@@ -23,6 +23,9 @@ import cn.dev33.satoken.exception.SaTokenException;
*/
public class SaFoxUtil {
private SaFoxUtil() {
}
/**
* 打印 Sa-Token 版本字符画
*/
@@ -275,8 +278,8 @@ public class SaFoxUtil {
* @return 拼接后的url字符串
*/
public static String joinParam(String url, String key, Object value) {
// 如果参数为空, 直接返回
if(isEmpty(url) || isEmpty(key) || isEmpty(value)) {
// 如果url或者key为空, 直接返回
if(isEmpty(url) || isEmpty(key)) {
return url;
}
return joinParam(url, key + "=" + value);
@@ -327,8 +330,8 @@ public class SaFoxUtil {
* @return 拼接后的url字符串
*/
public static String joinSharpParam(String url, String key, Object value) {
// 如果参数为空, 直接返回
if(isEmpty(url) || isEmpty(key) || isEmpty(value)) {
// 如果url或者key为空, 直接返回
if(isEmpty(url) || isEmpty(key)) {
return url;
}
return joinSharpParam(url, key + "=" + value);
@@ -390,7 +393,7 @@ public class SaFoxUtil {
* @return 拼接后的url字符串
*/
public static boolean isUrl(String str) {
if(str == null) {
if(isEmpty(str)) {
return false;
}
return str.toLowerCase().matches(URL_REGEX);

View File

@@ -43,10 +43,8 @@ public class SaResult extends LinkedHashMap<String, Object> implements Serializa
* 根据 Map 快速构建
* @param map /
*/
public SaResult(Map<String, Object> map) {
for (String key: map.keySet()) {
this.set(key, map.get(key));
}
public SaResult(Map<String, ?> map) {
this.setMap(map);
}
/**

View File

@@ -7,6 +7,8 @@ package cn.dev33.satoken.util;
*/
public class SaTokenConsts {
private SaTokenConsts() {
}
// =================== sa-token版本信息 ===================