what do you think about something like ```val par...
# strikt
c
what do you think about something like
Copy code
val parsed=expectThat("""{"abc":"def"}""").isValidJsonFor<MyType>()
👎 1
and also
Copy code
expectThat("""{"abc":"def"}""").isValidJsonFor<MyType>().get{abc}.isEqualTo("def")
r
Yeah, I think I’ve written assertions like that in projects I’m working on
I think the trick there may be that you’ve missed one of the inputs — in Jackson the
ObjectMapper
that may have customizations required to deserialize the type correctly
c
when i unit test my rest apis i try to use a mapper without any settings. but the mapper could be just passed to the isValidJsonFor() method (and the method renamed)
or there could be a way to configure strikt v2.
val expectThat=strikt(jackson=...)