We're currently writing a few unit tests and wante...
# spring
g
We're currently writing a few unit tests and wanted to test equality of
org.springframework.web.reactive.function.server.ServerResponse
but it appears equality cannot be used to test them. e.g. this will fail
Copy code
@Test
    fun `Server Responses should equal each other`() {
        val a = ServerResponse.accepted()
        val b = ServerResponse.accepted()
        a shouldBe b
    }
If this is done by design, what is the recommended method? Currently our workaround is to inspect the inserters value param to validate the body but this seems pretty hacky and brittle
Copy code
coEvery { BodyInserters.fromValue<Map<String, Any>>(any()) } returns mockk()
   runBlocking {
      error.toServerResponse()
   }
   coVerify {
      BodyInserters.fromValue(error.responseBody)
   }
}