首页 > 解决方案 > 错误测试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

标签: javajunit

解决方案


推荐阅读