I am writing a junit test case which I need to give the following data file (request):
data_file:
{
"birthDate" : "2017-12-08"
}
The junit test file uses:
fasterxml.jackson.databind.ObjectMapper.readValue(data_file)
to read this request data file and convert the date into XMLGregorianCalendar. However, the converted value has a "Z" at the end, I think that is the default time zone:
2017-12-08T00:00:00.000Z
I can't change the java class that contains the code for reading the Json value because we don't own the code. So what date string should I give in my test data file so that the "Z" won't appear at the end of converted XMLGregorianCalendar value?
2017-12-08T00:00:00.000
Many Thanks.
I don’t know how your JSON mapper gets to the result it does. I tried:
This prints
No offset from UTC and also no time of day, just the same string as I fed into the
XMLGregorianCalendar
.However, once you have got an
XMLGregorianCalendar
, say,xgc
, you can remove the offset by setting it to undefined:Now the
toString
method will produce a string without theZ
in the end.