java - 错误测试junit时间戳java格式json
问题描述
我目前在约会测试中遇到问题,我不知道如何摆脱它我找了很长时间,但如果有人可以帮助我,我无事可做提前谢谢你
Timestamp timestamp = Timestamp.valueOf(now);
Country country = new Country("France", timestamp);
given(countryService.getDetail(anyString())).willReturn(country);
mockMvc.perform(MockMvcRequestBuilders.get("/api/country/France"))
.andExpect(status().isOk())
.andExpect(jsonPath("country").value("France"))
.andExpect(jsonPath("lastUpdate").value(timestamp));
java.lang.AssertionError:JSON 路径“lastUpdate”预期:2021-04-29T15:05:09.090235 实际:2021-04-29T13:05:09.090+00:00
解决方案
推荐阅读
- gradle - 显示 JavaExec 任务的标准输出
- html - 使 div 覆盖完全匹配视频 div
- python - 在 ast.ImportFrom 中查找 end_lineno
- android - 添加 Gradle 依赖关系会破坏 Gradle 构建
- python - Python 新手。有人可以向我解释这行代码吗?
- audio - 您可以在 Autohotkey 中录制音频或系统音频吗?
- text - 尝试识别类似于 ruby 注释的文本降价
- vba - 仅在选定组件中应用 MACRO (swModel.GetComponents)
- javascript - 有人可以帮我 TypeError: Cannot read property 'map' of undefined
- dns - Cloudflare 将域转换为 Cloudflare 公共 IP,而不是我的服务器公共 IP