Answer the question
In order to leave comments, you need to log in
Where should the DTO -> Entity conversion methods be and vice versa?
I placed methods in services. Convenient, but there was a problem during testing. The DTO conversion method is called in almost every service method. And now, when testing, I have to check each time if the result matches the desired one, instead of just verify whether the method was called and that's it ( verify cannot be called not on a mock).
There was an idea to transfer the method to a separate class, but I am weak in good practices.
Tell me, please, where would it be correct to transfer these conversion methods?
Should I create a separate mapper package with classes in it? Let's say the EmployeeMapper class has two methods toEmployee, toEmployeeDTO? Am I thinking right?
PS maptract can't use
Answer the question
In order to leave comments, you need to log in
Should I create a separate mapper package with classes in it? Let's say the EmployeeMapper class has two methods toEmployee, toEmployeeDTO? Am I thinking right?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question