Relative Content

Tag Archive for spring-bootjunitspring-testmockmvc

Junit expecting a 400 response but getting a 200

I am trying to test my springboot controller /save endpoint. I want to test that if you send a json request with a null agency name you should get back a 400 status and the response “Agency Name cannot be null.”
This works during local testing with postman, but I haven’t been able to get it working in junit.