jeudi 29 novembre 2018

Should test @RestController or just @Service

I have a application with 3 layers: Controller, Service and Repository.

  • My controller is a Rest (@RestController in spring) that only get a request using a DTO, convert to a Model and pass to a service (@Service in spring).

  • My service have all bussiness logic and my Test classes are based on service classes only.

  • My repository is only a JpaRepository and sometimes use a custom query with @Query.

Well, as i said i just make test classes for Service, because here is my bussiness logic. My doubt is about create test for Controllers classes, is really necessary ? this is a good practice ?

Aucun commentaire:

Enregistrer un commentaire