I have something like this in my unit test controller:
AppointmentDTO[] getAppointmentResult = objectMapper.readValue(result.getResponse().getContentAsString(), AppointmentDTO[].class);
AppointmentDTO:
public record AppointmentDTO(ProcessingCentre branchName, ProcessingCentre branchId, LocalDate firstAvailableDate) {
public AppointmentDTO(ProcessingCentre branchName, LocalDate startDate, Integer noDaysAhead) {
this(branchName, branchName, RandomDateGenerator.randomDateGenerator(startDate,noDaysAhead));
}
}
But there seems to be a problem with how the mapping is done. I'm pretty sure the problem is in AppointmentDTO[].class
as it's not a class anymore but rather a record. The error I'm getting is InvalidDefinition
Thanks for your time