java - How do I access the underlying Jackson ObjectMapper in REST Assured? -


I have to configure the built-in Jackson Object Mapper in Rick Ashtard. I am writing another API test using REST Assured and I need to define some filters to register with Object Mapper, which is to serialize my object to JSN:

 < Code> string newTestSuite = "{\" name \ ": \" via added API \ ", \" description \ ": \" test description \ ", \" steps \ ": []}"; FilterProvider Filter = New SimpleFilterProvider (). AddFilter ("createNewTestSuite", New NewTestSuiteFilter ()); ObjectMaper ohm = new objectMap (); Om.setFilters (filter); {TestSuite ts = om.readValue (newCaspianTest, TestSuite.class); Request Sprint Request SEPEC = New Request Specbuilder () .setBaseUri ("https://somesite.com") .setBody (ts) .setUrlEncodingEnabled (incorrect) .build (); Demonstration demonstrationSpeak = new responseSpinkBilder (). ExpectStatusCode (200) Xpenstatslline (Mattspers content string ("200 OK")) Build (); RestAssured.given () .auth () Original ("testUser", "testPassword") .spec (requestSpec) .log (). All () .post ("/ restendpoint"). Then () .log (). All () .spec (responseSpec); Catch (Jason Purs Exception JP) {} Catch (Jason Mapping Express JME) {} Catch (IOexpress ioe) {}}  

}

You can try:

  restAssured.config = RestAssuredConfig .config () ObjectMapperConfig (New ObjectMaper Config () .Jaxson2 ObjectMapffect (New Jackson2 ObjectMapffect () {@ OverridePublic ObjectMap (Class Class, Strings S) {Filter Provider Filters = New Simple FilterProvider (.) AddFilter (...); objectMapper objectMapper = New ObjectMaper (); ObjectMaper .setFilters (Filter); Return Object Maper;}}));  

Comments

Popular posts from this blog

Member with no value in F# -

java - Joda Time Interval Not returning what I expect -

c# - Showing a SelectedItem's Property -