测试工具类
This commit is contained in:
parent
b3dfb2102b
commit
2af0646d25
@ -888,25 +888,57 @@ public class FormatUtil {
|
||||
{"yyyy-MM-dd HH:mm:ss", "^\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}$"},
|
||||
{"yyyy-MM-dd_HH:mm:ss", "^\\d{4}-\\d{2}-\\d{2}_\\d{2}:\\d{2}:\\d{2}$"},
|
||||
{"yyyy/MM/dd HH:mm:ss", "^\\d{4}/\\d{2}/\\d{2} \\d{2}:\\d{2}:\\d{2}$"},
|
||||
{"yyyy-M-d HH:mm:ss", "^\\d{4}-\\d{1}-\\d{1} \\d{2}:\\d{2}:\\d{2}$"},
|
||||
{"yyyy-M-d_HH:mm:ss", "^\\d{4}-\\d{1}-\\d{1}_\\d{2}:\\d{2}:\\d{2}$"},
|
||||
{"yyyy/M/d HH:mm:ss", "^\\d{4}/\\d{1}/\\d{1} \\d{2}:\\d{2}:\\d{2}$"},
|
||||
|
||||
// 紧凑格式
|
||||
{"yyyyMMddHHmmss", "^\\d{14}$"},
|
||||
{"yyyyMMdd", "^\\d{8}$"},
|
||||
|
||||
// 中文格式
|
||||
{"yyyy年M月d日 HH时mm分ss秒", "^\\d{4}年\\d{1}月\\d{1}日 \\d{1,2}时\\d{1,2}分\\d{1,2}秒$"},
|
||||
{"yyyy年M月d日 HH:mm:ss", "^\\d{4}年\\d{1}月\\d{1}日 \\d{1,2}:\\d{1,2}:\\d{1,2}$"},
|
||||
{"yyyy年M月d日 HH时mm分", "^\\d{4}年\\d{1}月\\d{1}日 \\d{1,2}时\\d{1,2}分$"},
|
||||
{"yyyy年M月d日 HH:mm", "^\\d{4}年\\d{1}月\\d{1}日 \\d{1,2}:\\d{1,2}$"},
|
||||
{"yyyy年M月dd日 HH时mm分ss秒", "^\\d{4}年\\d{1}月\\d{1,2}日 \\d{1,2}时\\d{1,2}分\\d{1,2}秒$"},
|
||||
{"yyyy年M月dd日 HH:mm:ss", "^\\d{4}年\\d{1}月\\d{1,2}日 \\d{1,2}:\\d{1,2}:\\d{1,2}$"},
|
||||
{"yyyy年M月dd日 HH时mm分", "^\\d{4}年\\d{1}月\\d{1,2}日 \\d{1,2}时\\d{1,2}分$"},
|
||||
{"yyyy年M月dd日 HH:mm", "^\\d{4}年\\d{1}月\\d{1,2}日 \\d{1,2}:\\d{1,2}$"},
|
||||
{"yyyy年MM月dd日 HH时mm分ss秒", "^\\d{4}年\\d{1,2}月\\d{1,2}日 \\d{1,2}时\\d{1,2}分\\d{1,2}秒$"},
|
||||
{"yyyy年MM月dd日 HH:mm:ss", "^\\d{4}年\\d{1,2}月\\d{1,2}日 \\d{1,2}时\\d{1,2}分\\d{1,2}秒$"},
|
||||
{"yyyy年MM月dd日 HH时mm分", "^\\d{4}年\\d{1,2}月\\d{1,2}日 \\d{1,2}时\\d{1,2}分$"},
|
||||
{"yyyy年MM月dd日 HH:mm", "^\\d{4}年\\d{1,2}月\\d{1,2}日 \\d{1,2}时\\d{1,2}分$"},
|
||||
{"yyyy年MM月dd日", "^\\d{4}年\\d{1,2}月\\d{1,2}日$"},
|
||||
|
||||
// 英文格式
|
||||
{"MM/dd/yyyy HH:mm:ss", "^\\d{1,2}/\\d{1,2}/\\d{4} \\d{1,2}:\\d{1,2}:\\d{1,2}$"},
|
||||
{"dd/MM/yyyy HH:mm:ss", "^\\d{1,2}/\\d{1,2}/\\d{4} \\d{1,2}:\\d{1,2}:\\d{1,2}$"},
|
||||
{"M/dd/yyyy HH:mm:ss", "^\\d{1}/\\d{2}/\\d{4} \\d{1,2}:\\d{1,2}:\\d{1,2}$"},
|
||||
{"d/MM/yyyy HH:mm:ss", "^\\d{1}/\\d{2}/\\d{4} \\d{1,2}:\\d{1,2}:\\d{1,2}$"},
|
||||
{"MM/d/yyyy HH:mm:ss", "^\\d{2}/\\d{1}/\\d{4} \\d{1,2}:\\d{1,2}:\\d{1,2}$"},
|
||||
{"dd/M/yyyy HH:mm:ss", "^\\d{2}/\\d{1}/\\d{4} \\d{1,2}:\\d{1,2}:\\d{1,2}$"},
|
||||
{"M/d/yyyy HH:mm:ss", "^\\d{1}/\\d{1}/\\d{4} \\d{1,2}:\\d{1,2}:\\d{1,2}$"},
|
||||
{"d/M/yyyy HH:mm:ss", "^\\d{1}/\\d{1}/\\d{4} \\d{1,2}:\\d{1,2}:\\d{1,2}$"},
|
||||
|
||||
{"HH:mm:ss MM/dd/yyyy", "^\\d{1,2}:\\d{1,2}:\\d{1,2} \\d{1,2}/\\d{1,2}/\\d{4}$"},
|
||||
{"HH:mm MM/dd/yyyy", "^\\d{1,2}:\\d{1,2} \\d{1,2}/\\d{1,2}/\\d{4}$"},
|
||||
{"HH:mm:ss MM-dd-yyyy", "^\\d{1,2}:\\d{1,2}:\\d{1,2} \\d{1,2}-\\d{1,2}-\\d{4}$"},
|
||||
{"HH:mm MM-dd-yyyy", "^\\d{1,2}:\\d{1,2} \\d{1,2}-\\d{1,2}-\\d{4}$"},
|
||||
|
||||
// ISO格式
|
||||
{"yyyy-MM-dd'T'HH:mm:ss.SSSZ", "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}[+-]\\d{4}$"},
|
||||
{"yyyy-MM-dd'T'HH:mm:ss", "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$"},
|
||||
|
||||
// 时间范围格式
|
||||
{"yyyy-MM-dd_HH:mm:ss~yyyy-MM-dd_HH:mm:ss", "^\\d{4}-\\d{2}-\\d{2}_\\d{2}:\\d{2}:\\d{2}~\\d{4}-\\d{2}-\\d{2}_\\d{2}:\\d{2}:\\d{2}$"}
|
||||
{"yyyy-MM-dd_HH:mm:ss~yyyy-MM-dd_HH:mm:ss", "^\\d{4}-\\d{2}-\\d{2}_\\d{2}:\\d{2}:\\d{2}~\\d{4}-\\d{2}-\\d{2}_\\d{2}:\\d{2}:\\d{2}$"},
|
||||
{"yyyy-M-dd_HH:mm:ss~yyyy-M-dd_HH:mm:ss", "^\\d{4}-\\d{1}-\\d{2}_\\d{2}:\\d{2}:\\d{2}~\\d{4}-\\d{1}-\\d{2}_\\d{2}:\\d{2}:\\d{2}$"},
|
||||
{"yyyy-MM-d_HH:mm:ss~yyyy-MM-d_HH:mm:ss", "^\\d{4}-\\d{2}-\\d{1}_\\d{2}:\\d{2}:\\d{2}~\\d{4}-\\d{2}-\\d{1}_\\d{2}:\\d{2}:\\d{2}$"},
|
||||
{"yyyy-M-d_HH:mm:ss~yyyy-M-d_HH:mm:ss", "^\\d{4}-\\d{1}-\\d{1}_\\d{2}:\\d{2}:\\d{2}~\\d{4}-\\d{1}-\\d{1}_\\d{2}:\\d{2}:\\d{2}$"},
|
||||
{"yyyy-MM-dd HH:mm:ss~yyyy-MM-dd HH:mm:ss", "^\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}~\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}$"},
|
||||
{"yyyy-M-dd HH:mm:ss~yyyy-M-dd HH:mm:ss", "^\\d{4}-\\d{1}-\\d{2} \\d{2}:\\d{2}:\\d{2}~\\d{4}-\\d{1}-\\d{2} \\d{2}:\\d{2}:\\d{2}$"},
|
||||
{"yyyy-MM-d HH:mm:ss~yyyy-MM-d HH:mm:ss", "^\\d{4}-\\d{2}-\\d{1} \\d{2}:\\d{2}:\\d{2}~\\d{4}-\\d{2}-\\d{1} \\d{2}:\\d{2}:\\d{2}$"},
|
||||
{"yyyy-M-d HH:mm:ss~yyyy-M-d HH:mm:ss", "^\\d{4}-\\d{1}-\\d{1} \\d{2}:\\d{2}:\\d{2}~\\d{4}-\\d{1}-\\d{1} \\d{2}:\\d{2}:\\d{2}$"}
|
||||
};
|
||||
|
||||
// 检查是否为时间戳
|
||||
|
@ -95,7 +95,7 @@ public class FormatUtilTest {
|
||||
log.info("实际结果: '{}'", result);
|
||||
assertEquals(expectedResult, result);
|
||||
|
||||
log.info("✓ 测试通过 - 格式转换结果正确");
|
||||
log.info("✅ 测试通过 - 格式转换结果正确");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -128,7 +128,7 @@ public class FormatUtilTest {
|
||||
assertNotNull(result);
|
||||
assertEquals(expectedResult, result);
|
||||
|
||||
log.info("✓ 测试通过 - 空值处理正确");
|
||||
log.info("✅ 测试通过 - 空值处理正确");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -166,7 +166,7 @@ public class FormatUtilTest {
|
||||
|
||||
// 断言验证
|
||||
assertNotNull(result);
|
||||
log.info("✓ 测试通过 - 格式不匹配处理正确");
|
||||
log.info("✅ 测试通过 - 格式不匹配处理正确");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -210,7 +210,7 @@ public class FormatUtilTest {
|
||||
log.info("实际结果:'{}'", result2);
|
||||
assertEquals(expectedResult2, result2);
|
||||
|
||||
log.info("✓ 测试通过 - 开始时间提取正确");
|
||||
log.info("✅ 测试通过 - 开始时间提取正确");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -248,7 +248,7 @@ public class FormatUtilTest {
|
||||
assertNotNull(result);
|
||||
assertEquals(expectedResult, result);
|
||||
|
||||
log.info("✓ 测试通过 - 无分隔符处理正确");
|
||||
log.info("✅ 测试通过 - 无分隔符处理正确");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -265,26 +265,132 @@ public class FormatUtilTest {
|
||||
log.info("========== 动态时间格式化模块测试 - 标准格式识别 ==========");
|
||||
|
||||
// 输入参数
|
||||
String inputTime = "2024-01-15T14:30:25Z";
|
||||
params.put("targetFormat", "yyyy-MM-dd HH:mm:ss");
|
||||
try {
|
||||
System.out.println();
|
||||
log.info("========== 格式1 ==========");
|
||||
String inputTime = "2024-01-15T14:30:25Z";
|
||||
params.put("targetFormat", "yyyy-MM-dd HH:mm:ss");
|
||||
log.info("输入参数:");
|
||||
log.info(" - 时间字符串: {}", inputTime);
|
||||
log.info(" - 目标格式: {}", params.get("targetFormat"));
|
||||
// 执行测试
|
||||
Object result = FormatUtil.dynamicTimeFormat(inputTime, params);
|
||||
// 断言验证
|
||||
String expectedResult = "2024-01-15 14:30:25";
|
||||
log.info("预期结果: '{}'", expectedResult);
|
||||
log.info("实际结果: '{}'", result);
|
||||
assertEquals(expectedResult, result);
|
||||
} catch (Exception ignore) {}
|
||||
|
||||
log.info("输入参数:");
|
||||
log.info(" - 时间字符串: {}", inputTime);
|
||||
log.info(" - 目标格式: {}", params.get("targetFormat"));
|
||||
// 输入参数
|
||||
try {
|
||||
System.out.println();
|
||||
log.info("========== 格式2 ==========");
|
||||
String inputTime = "2024-01-15_14:30:25";
|
||||
params.put("targetFormat", "yyyy-MM-dd HH:mm:ss");
|
||||
log.info("输入参数:");
|
||||
log.info(" - 时间字符串: {}", inputTime);
|
||||
log.info(" - 目标格式: {}", params.get("targetFormat"));
|
||||
// 执行测试
|
||||
Object result = FormatUtil.dynamicTimeFormat(inputTime, params);
|
||||
// 断言验证
|
||||
String expectedResult = "2024-01-15 14:30:25";
|
||||
log.info("预期结果: '{}'", expectedResult);
|
||||
log.info("实际结果: '{}'", result);
|
||||
assertEquals(expectedResult, result);
|
||||
} catch (NoClassDefFoundError ignore) {}
|
||||
|
||||
// 预期结果
|
||||
String expectedResult = "2024-01-15 14:30:25";
|
||||
log.info("预期结果: {}", expectedResult);
|
||||
// 输入参数
|
||||
try {
|
||||
System.out.println();
|
||||
log.info("========== 格式3 ==========");
|
||||
String inputTime = "2024/01/15 14:30:25";
|
||||
params.put("targetFormat", "yyyy-MM-dd HH:mm:ss");
|
||||
log.info("输入参数:");
|
||||
log.info(" - 时间字符串: {}", inputTime);
|
||||
log.info(" - 目标格式: {}", params.get("targetFormat"));
|
||||
// 执行测试
|
||||
Object result = FormatUtil.dynamicTimeFormat(inputTime, params);
|
||||
// 断言验证
|
||||
String expectedResult = "2024-01-15 14:30:25";
|
||||
log.info("预期结果: '{}'", expectedResult);
|
||||
log.info("实际结果: '{}'", result);
|
||||
assertEquals(expectedResult, result);
|
||||
} catch (NoClassDefFoundError ignore) {}
|
||||
|
||||
// 执行测试
|
||||
Object result = FormatUtil.dynamicTimeFormat(inputTime, params);
|
||||
// 输入参数
|
||||
try {
|
||||
System.out.println();
|
||||
log.info("========== 格式4 ==========");
|
||||
String inputTime = "2025年09月30日 11时55分";
|
||||
params.put("targetFormat", "yyyy-MM-dd HH:mm:ss");
|
||||
log.info("输入参数:");
|
||||
log.info(" - 时间字符串: {}", inputTime);
|
||||
log.info(" - 目标格式: {}", params.get("targetFormat"));
|
||||
// 执行测试
|
||||
Object result = FormatUtil.dynamicTimeFormat(inputTime, params);
|
||||
// 断言验证
|
||||
String expectedResult = "2025-09-30 11:55:00";
|
||||
log.info("预期结果: '{}'", expectedResult);
|
||||
log.info("实际结果: '{}'", result);
|
||||
assertEquals(expectedResult, result);
|
||||
} catch (NoClassDefFoundError ignore) {}
|
||||
|
||||
// 实际结果
|
||||
log.info("实际结果: {}", result);
|
||||
// 输入参数
|
||||
try {
|
||||
System.out.println();
|
||||
log.info("========== 格式5 ==========");
|
||||
String inputTime = "2025年09月29日 11:55:22";
|
||||
params.put("targetFormat", "yyyy-MM-dd HH:mm:ss");
|
||||
log.info("输入参数:");
|
||||
log.info(" - 时间字符串: {}", inputTime);
|
||||
log.info(" - 目标格式: {}", params.get("targetFormat"));
|
||||
// 执行测试
|
||||
Object result = FormatUtil.dynamicTimeFormat(inputTime, params);
|
||||
// 断言验证
|
||||
String expectedResult = "2025-09-29 11:55:22";
|
||||
log.info("预期结果: '{}'", expectedResult);
|
||||
log.info("实际结果: '{}'", result);
|
||||
assertEquals(expectedResult, result);
|
||||
} catch (NoClassDefFoundError ignore) {}
|
||||
|
||||
// 断言验证
|
||||
assertEquals(expectedResult, result);
|
||||
log.info("✓ 测试通过 - 标准格式识别正确");
|
||||
// 输入参数
|
||||
try {
|
||||
System.out.println();
|
||||
log.info("========== 格式6 ==========");
|
||||
String inputTime = "2025年9月29日 11:55:22";
|
||||
params.put("targetFormat", "yyyy-MM-dd HH:mm:ss");
|
||||
log.info("输入参数:");
|
||||
log.info(" - 时间字符串: {}", inputTime);
|
||||
log.info(" - 目标格式: {}", params.get("targetFormat"));
|
||||
// 执行测试
|
||||
Object result = FormatUtil.dynamicTimeFormat(inputTime, params);
|
||||
// 断言验证
|
||||
String expectedResult = "2025-09-29 11:55:22";
|
||||
log.info("预期结果: '{}'", expectedResult);
|
||||
log.info("实际结果: '{}'", result);
|
||||
assertEquals(expectedResult, result);
|
||||
} catch (NoClassDefFoundError ignore) {}
|
||||
|
||||
// 输入参数
|
||||
try {
|
||||
System.out.println();
|
||||
log.info("========== 格式7 ==========");
|
||||
String inputTime = "14:30 01/15/2024";
|
||||
params.put("targetFormat", "yyyy-MM-dd HH:mm:ss");
|
||||
log.info("输入参数:");
|
||||
log.info(" - 时间字符串: {}", inputTime);
|
||||
log.info(" - 目标格式: {}", params.get("targetFormat"));
|
||||
// 执行测试
|
||||
Object result = FormatUtil.dynamicTimeFormat(inputTime, params);
|
||||
// 断言验证
|
||||
String expectedResult = "2024-01-15 14:30:00";
|
||||
log.info("预期结果: '{}'", expectedResult);
|
||||
log.info("实际结果: '{}'", result);
|
||||
assertEquals(expectedResult, result);
|
||||
} catch (NoClassDefFoundError ignore) {}
|
||||
|
||||
log.info("✅ 测试通过 - 标准格式识别正确");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -320,7 +426,7 @@ public class FormatUtilTest {
|
||||
|
||||
// 断言验证
|
||||
assertEquals(expectedResult, result);
|
||||
log.info("✓ 测试通过 - 中文格式识别正确");
|
||||
log.info("✅ 测试通过 - 中文格式识别正确");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -357,7 +463,7 @@ public class FormatUtilTest {
|
||||
|
||||
// 断言验证
|
||||
assertEquals(expectedResult, result);
|
||||
log.info("✓ 测试通过 - 格式验证正确");
|
||||
log.info("✅ 测试通过 - 格式验证正确");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -395,7 +501,7 @@ public class FormatUtilTest {
|
||||
|
||||
// 断言验证
|
||||
assertEquals(expectedResult, result);
|
||||
log.info("✓ 测试通过 - 格式验证失败检测正确");
|
||||
log.info("✅ 测试通过 - 格式验证失败检测正确");
|
||||
}
|
||||
|
||||
// ==================== 字符串处理模块测试 ====================
|
||||
@ -437,7 +543,7 @@ public class FormatUtilTest {
|
||||
|
||||
// 断言验证
|
||||
assertEquals(expectedResult, result);
|
||||
log.info("✓ 测试通过 - 字符串截取正确");
|
||||
log.info("✅ 测试通过 - 字符串截取正确");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -477,7 +583,7 @@ public class FormatUtilTest {
|
||||
|
||||
// 断言验证
|
||||
assertNotNull(result);
|
||||
log.info("✓ 测试通过 - 起始位置超界处理正确");
|
||||
log.info("✅ 测试通过 - 起始位置超界处理正确");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -513,7 +619,7 @@ public class FormatUtilTest {
|
||||
log.info("预期结果: {}", expectedResult);
|
||||
log.info("实际结果: {}", result);
|
||||
assertEquals(expectedResult, result);
|
||||
log.info("✓ 测试通过 - 正则替换正确");
|
||||
log.info("✅ 测试通过 - 正则替换正确");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -590,7 +696,7 @@ public class FormatUtilTest {
|
||||
log.info("实际结果:'{}'", result4);
|
||||
assertEquals(expectedResult4, result4);
|
||||
|
||||
log.info("✓ 测试通过 - 正则替换正确");
|
||||
log.info("✅ 测试通过 - 正则替换正确");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -624,7 +730,7 @@ public class FormatUtilTest {
|
||||
|
||||
// 断言验证
|
||||
assertEquals(expectedResult, result);
|
||||
log.info("✓ 测试通过 - 大小写转换正确");
|
||||
log.info("✅ 测试通过 - 大小写转换正确");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -653,7 +759,7 @@ public class FormatUtilTest {
|
||||
log.info("实际结果: '{}'", result);
|
||||
assertEquals(expectedResult, result);
|
||||
|
||||
log.info("✓ 测试通过 - 空格去除正确");
|
||||
log.info("✅ 测试通过 - 空格去除正确");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -691,7 +797,7 @@ public class FormatUtilTest {
|
||||
|
||||
// 断言验证
|
||||
assertEquals(expectedResult, result);
|
||||
log.info("✓ 测试通过 - 基础字符串替换正确");
|
||||
log.info("✅ 测试通过 - 基础字符串替换正确");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -725,7 +831,7 @@ public class FormatUtilTest {
|
||||
log.info("预期结果:'{}'", expectedResult);
|
||||
log.info("实际结果:'{}'", result);
|
||||
assertEquals(expectedResult, result);
|
||||
log.info("✓ 测试通过 - 大小写敏感替换正确");
|
||||
log.info("✅ 测试通过 - 大小写敏感替换正确");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -767,7 +873,7 @@ public class FormatUtilTest {
|
||||
|
||||
// 断言验证
|
||||
assertEquals(expectedResult, result);
|
||||
log.info("✓ 测试通过 - 整词匹配替换正确");
|
||||
log.info("✅ 测试通过 - 整词匹配替换正确");
|
||||
}
|
||||
|
||||
// ==================== 坐标系转换模块测试 ====================
|
||||
@ -802,7 +908,7 @@ public class FormatUtilTest {
|
||||
log.info("实际结果:'{}'", result);
|
||||
assertEquals(expectedResult, result);
|
||||
|
||||
log.info("✓ 测试通过 - 度分秒转十进制转换正确");
|
||||
log.info("✅ 测试通过 - 度分秒转十进制转换正确");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -836,7 +942,7 @@ public class FormatUtilTest {
|
||||
log.info("实际结果:'{}'", result);
|
||||
assertEquals(expectedResult, result);
|
||||
|
||||
log.info("✓ 测试通过 - 十进制转度分秒转换正确");
|
||||
log.info("✅ 测试通过 - 十进制转度分秒转换正确");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -878,7 +984,7 @@ public class FormatUtilTest {
|
||||
|
||||
// 断言验证
|
||||
assertNotNull(result);
|
||||
log.info("✓ 测试通过 - 直角坐标转极坐标转换正确");
|
||||
log.info("✅ 测试通过 - 直角坐标转极坐标转换正确");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -913,7 +1019,7 @@ public class FormatUtilTest {
|
||||
|
||||
// 断言验证
|
||||
assertNotNull(result);
|
||||
log.info("✓ 测试通过 - 坐标格式标准化正确");
|
||||
log.info("✅ 测试通过 - 坐标格式标准化正确");
|
||||
}
|
||||
|
||||
// ==================== 极值/边界值检查处理模块测试 ====================
|
||||
@ -955,7 +1061,7 @@ public class FormatUtilTest {
|
||||
|
||||
// 断言验证
|
||||
assertEquals(expectedResult, result);
|
||||
log.info("✓ 测试通过 - 正常范围检查正确");
|
||||
log.info("✅ 测试通过 - 正常范围检查正确");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -996,7 +1102,7 @@ public class FormatUtilTest {
|
||||
|
||||
// 断言验证
|
||||
assertEquals(expectedResult, result);
|
||||
log.info("✓ 测试通过 - 超出上限截断处理正确");
|
||||
log.info("✅ 测试通过 - 超出上限截断处理正确");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1039,7 +1145,7 @@ public class FormatUtilTest {
|
||||
|
||||
// 断言验证
|
||||
assertEquals(expectedResult, result);
|
||||
log.info("✓ 测试通过 - 超出下限默认值处理正确");
|
||||
log.info("✅ 测试通过 - 超出下限默认值处理正确");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1079,7 +1185,7 @@ public class FormatUtilTest {
|
||||
|
||||
// 断言验证
|
||||
assertNotNull(result);
|
||||
log.info("✓ 测试通过 - 异常值检测正确");
|
||||
log.info("✅ 测试通过 - 异常值检测正确");
|
||||
}
|
||||
|
||||
// ==================== 数据KV映射处理模块测试 ====================
|
||||
@ -1215,7 +1321,7 @@ public class FormatUtilTest {
|
||||
assertEquals(expectedResultString5, resultString5, String.format("转换为短横线命名%s失败", params.get("keyFormat")));
|
||||
|
||||
|
||||
log.info("✓ 测试通过 - 键名格式转换正确");
|
||||
log.info("✅ 测试通过 - 键名格式转换正确");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1257,7 +1363,7 @@ public class FormatUtilTest {
|
||||
if(result instanceof Map) {
|
||||
boolean flag = false;
|
||||
}
|
||||
log.info("✓ 测试通过 - 数据过滤正确");
|
||||
log.info("✅ 测试通过 - 数据过滤正确");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1305,7 +1411,7 @@ public class FormatUtilTest {
|
||||
log.info("预期结果:'{}'", expectedResult);
|
||||
log.info("实际结果:'{}'", result);
|
||||
assertEquals(expectedResultString, resultString, "排序失败");
|
||||
log.info("✓ 测试通过 - 分组排序正确");
|
||||
log.info("✅ 测试通过 - 分组排序正确");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1344,7 +1450,7 @@ public class FormatUtilTest {
|
||||
// 断言验证
|
||||
assertNotNull(result);
|
||||
assertTrue(result.toString().contains("name") && result.toString().contains("张三"));
|
||||
log.info("✓ 测试通过 - 输出格式转换正确");
|
||||
log.info("✅ 测试通过 - 输出格式转换正确");
|
||||
}
|
||||
|
||||
// ==================== 综合测试用例 ====================
|
||||
@ -1409,7 +1515,7 @@ public class FormatUtilTest {
|
||||
|
||||
// 断言验证
|
||||
assertEquals(expectedResult, checkedValue);
|
||||
log.info("✓ 测试通过 - 多方法组合使用正确");
|
||||
log.info("✅ 测试通过 - 多方法组合使用正确");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1457,7 +1563,7 @@ public class FormatUtilTest {
|
||||
// 断言验证
|
||||
assertTrue(duration < 100, "性能测试应在0.1秒内完成");
|
||||
|
||||
log.info("✓ 测试通过 - 性能表现符合要求");
|
||||
log.info("✅ 测试通过 - 性能表现符合要求");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1490,7 +1596,7 @@ public class FormatUtilTest {
|
||||
log.info("实际结果: '{}'", result);
|
||||
assertEquals(expectedResult, result);
|
||||
|
||||
log.info("✓ 测试通过 - 异常处理正确");
|
||||
log.info("✅ 测试通过 - 异常处理正确");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1530,6 +1636,6 @@ public class FormatUtilTest {
|
||||
|
||||
// 断言验证
|
||||
assertNotNull(result);
|
||||
log.info("✓ 测试通过 - 边界值处理正确");
|
||||
log.info("✅ 测试通过 - 边界值处理正确");
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user