Hi,
Very interesting use case. There's currently no good way to map a result to another type but I would be happy to add that if we can find a nice way to do it (API wise). A workaround that might work would be something like this (I haven't tried it):
body("LocalDate.parse( find { it.transId == '21447350'}.transDt )", before(LocalDate.now())));
But I wouldn't recommend doing this. One future approach might be to apply a mapping function (similar to what is currently present when validating headers):
body("find { it.transId == '21447350'}.transDt", LocalDate::parse, before(LocalDate.now()));
I like this approach but the problem is that I have to create a lot of new overloaded methods to support it. Also it will not work (without major effort) if you define multiple expectations in the same body clause (which is generally recommended since all errors are then reported at once):
// Won't work when defining expectations like this:
body("x.y", equalTo("something"),
"x.z", equalTo("something else"));
But perhaps that's fine? Potentially this could work:
body("x.y", equalTo("something"),
"x.z", LocalDate::parse, equalTo(...));
but it'll require much more work to implement. What do you think?
/Johan