I am working on a REST Spring Boot
sample project, which does:
In this process, I hardly write business conditional statements. Do I really need Mockito
to the Controller
, DAO
and Service
layers ?
I can do the same thing by hitting the end point with request.
Yes, you need a mockito. You can test your rest by hitting the rest by a valid request. But with writing tests, you can run many tests for the same rest for different scenarios with one click. SO you need to write tests to cover all the testing scenarios with one click. on the other hand, if you would test all scenarios through real requests, you need a lot of time and you may make invalid tests. Fianlly, you need a mockito so that you can proceed with unit tests.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.