mirror of
https://github.com/ccmjga/zhilu-admin
synced 2026-03-14 05:33:42 +08:00
fix dayjs
This commit is contained in:
@@ -23,7 +23,6 @@ public class UserRolePermissionDto {
|
||||
private Boolean enable;
|
||||
@Builder.Default private List<RoleDto> roles = new LinkedList<>();
|
||||
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private OffsetDateTime createTime;
|
||||
|
||||
public Set<PermissionRespDto> getPermissions() {
|
||||
|
||||
@@ -58,21 +58,21 @@ public class JacksonAnnotationMvcTest {
|
||||
.andExpect(jsonPath("$.data[0].password").doesNotExist());
|
||||
}
|
||||
|
||||
@Test
|
||||
@WithMockUser
|
||||
void dateFieldWithFormatAnnotation_whenResponseIncludeField_fieldShouldBeExpectDataFormat()
|
||||
throws Exception {
|
||||
OffsetDateTime stubCreateDateTime =
|
||||
OffsetDateTime.of(2023, 12, 2, 1, 1, 1, 0, OffsetDateTime.now().getOffset());
|
||||
UserRolePermissionDto stubUserRolePermissionDto = new UserRolePermissionDto();
|
||||
stubUserRolePermissionDto.setCreateTime(stubCreateDateTime);
|
||||
when(identityAccessService.pageQueryUser(any(PageRequestDto.class), any(UserQueryDto.class)))
|
||||
.thenReturn(new PageResponseDto<>(1, List.of(stubUserRolePermissionDto)));
|
||||
mockMvc
|
||||
.perform(
|
||||
get(String.format("/iam/users?page=1&size=5&username=%s", "7bF3mcNVTj6P6v2"))
|
||||
.contentType(MediaType.APPLICATION_FORM_URLENCODED))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.data[0].createTime").value("2023-12-02 01:01:01"));
|
||||
}
|
||||
// @Test
|
||||
// @WithMockUser
|
||||
// void dateFieldWithFormatAnnotation_whenResponseIncludeField_fieldShouldBeExpectDataFormat()
|
||||
// throws Exception {
|
||||
// OffsetDateTime stubCreateDateTime =
|
||||
// OffsetDateTime.of(2023, 12, 2, 1, 1, 1, 0, OffsetDateTime.now().getOffset());
|
||||
// UserRolePermissionDto stubUserRolePermissionDto = new UserRolePermissionDto();
|
||||
// stubUserRolePermissionDto.setCreateTime(stubCreateDateTime);
|
||||
// when(identityAccessService.pageQueryUser(any(PageRequestDto.class), any(UserQueryDto.class)))
|
||||
// .thenReturn(new PageResponseDto<>(1, List.of(stubUserRolePermissionDto)));
|
||||
// mockMvc
|
||||
// .perform(
|
||||
// get(String.format("/iam/users?page=1&size=5&username=%s", "7bF3mcNVTj6P6v2"))
|
||||
// .contentType(MediaType.APPLICATION_FORM_URLENCODED))
|
||||
// .andExpect(status().isOk())
|
||||
// .andExpect(jsonPath("$.data[0].createTime").value("2023-12-02 01:01:01"));
|
||||
// }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user