Menu
Newbedev LogoNEWBEDEV Python Javascript Linux Cheat sheet
Newbedev LogoNEWBEDEV
  • Python 1
  • Javascript
  • Linux
  • Cheat sheet
  • Contact

MockRestServiceServer: how to mock a POST call with a body?

You can use content().string to verify body:

.andExpect(content().string(expectedContent))

Or content().bytes:

this.mockServer.expect(content().bytes("foo".getBytes()))

this.mockServer.expect(content().string("foo"))

Tags:

Java

Junit

Spring

Spring Boot

Spring Rest

Related

How to restore linear git history after nonlinear merge? How to save enum field in the database room? Cordova doesn't send origin on request in some Android devices Enable Cors in Firebase Cloud Function How to install packages in conda that are not available in anaconda? (conda:4.7.5, python:3.7.3) Not able to validate request body in Spring boot with @Valid Xdebug with Visual Studio Code ignores some breakpoints How to push to Github package registry with Gradle "How to fix 'Error: must either provide a name or specify --generate-name' in Helm" How to return a Button from a function in SwiftUI? How to turn off type hint in java stream sequences How to call method at App start if I am using provider?

Recent Posts

Pandas how to find column contains a certain value Recommended way to install multiple Python versions on Ubuntu 20.04 Build super fast web scraper with Python x100 than BeautifulSoup How to convert a SQL query result to a Pandas DataFrame in Python How to write a Pandas DataFrame to a .csv file in Python
© 2021 newbedevPrivacy Policy