Not a comparable: Error while comparing EPOC Date

30 views
Skip to first unread message

Veena Devi

unread,
Nov 3, 2022, 7:08:55 AM11/3/22
to wiremock-user
Hi Team 

I am trying to validate the 2 Epoc values in wiremock responce template 

Query 

:v1/payments?from=1664791480000&to=1667469880000


when I tried for Request template i am not to handle from value 

{{#and (lt request.query.from 946684800) (gt request.query.to 4765046400)}}
{
  "messsage": "success"
}

getting

java.lang.IllegalArgumentException: Not a comparable: 1664791480000

Please let me know to handle epoc values

Cheers
Veena

Tom Akehurst

unread,
Nov 3, 2022, 8:19:21 AM11/3/22
to wiremock-user
Because query parameters can be multi-valued the request.query.x value is an array.

If you access the first element like this it should work as expected e.g.
request.query.to.0

Veena Devi

unread,
Nov 8, 2022, 6:10:01 AM11/8/22
to wiremock-user

The value is coming out but there is a issue in converting and comparing against EPOC Value

Tom Akehurst

unread,
Nov 8, 2022, 8:56:05 AM11/8/22
to wiremock-user
If you share the full response body you're using and the request you're making I might be able to suggest a fix.

Tom Akehurst

unread,
Nov 9, 2022, 6:20:49 AM11/9/22
to wiremock-user
Try this (both query parameters need to be dereferenced as arrays):

{{#and (lt request.query.from.0 946684800) (gt request.query.to.0 4765046400)}}

Reply all
Reply to author
Forward
0 new messages