Skip to content

Tag: mockmvc

JUnit4 failed to load application context

I am trying to use JUnit4 for testing of my project. I have tried using JUnit5 but I cannot get this working either. I am trying to test my account controller at the momemnt. This is the full stack trace of the error I am receving Here is my build.gradle: } This is the version of spring boot I am

No mapping for request with mockmvc

Currently struggling with problem when I get ‘mapping error for request’ with following controller/test configuration. Controller: Test: Configuration: After test execution I get No mapping for POST /subscriber/session The reason for the struggle is that my code from other modules with the same co…

Get size of json from MvcResult

I’m testing an API and get all data from the DB. I save the response as I get a json as response. I want to get the length of json array. So, if I have 2 rows in DB, I want to get 2 as a result. Or is there maybe another way to count number of rows which are