dimanche 9 juin 2019

How to test particular conditions in controller layer?

So... I have a simple method "addUser" in my controller. I want to test the first if-statement when user with given email already exists in database. In setUp method I create a sample user with fields like firstname, lastname, email etc. When I put the exacttly same email as a param in mockMvc I expected it to return the "register/new-register" but instead it returns "register/register-success". Im newbie as it comes to testing, couldn't find an answer for this problem. Here's the screenshot of my code. Please tell me how to test this part or at least if im even doing it right 😂 (cant upload image yet to here's the the link :/ )

Code

Aucun commentaire:

Enregistrer un commentaire