Skip to main content

Timeline for Unit test Service Class [duplicate]

Current License: CC BY-SA 4.0

10 events
when toggle format what by license comment
Aug 28, 2019 at 8:28 vote accept Hamza Ince
Aug 27, 2019 at 16:38 history closed gnat
BobDalgleish
Bart van Ingen Schenau
Robert Harvey
Duplicate of How do you unit test private methods?
Aug 27, 2019 at 14:48 answer added Jon Raynor timeline score: 0
Aug 27, 2019 at 12:50 review Close votes
Aug 27, 2019 at 16:40
Aug 27, 2019 at 12:44 comment added Hamza Ince It makes sense, thank you for your time
Aug 27, 2019 at 12:41 comment added David Arno "The question How do you unit test private methods? is helpful, but in my situation, my Service contain multiple methods, and only one public method, should I still not unit test private methods?" Test those private methods, but only trough the public one. Those private methods are implementation details and you may at some stage choose to completely change them. If you test through the public method, then a failing test means you messed up in your refactor. Test those private methods though and you have brittle tests that will fail because the details changed, not the result. That's bad.
Aug 27, 2019 at 12:37 history edited Hamza Ince CC BY-SA 4.0
added 277 characters in body
Aug 27, 2019 at 12:35 comment added Hamza Ince @gnat I want to add one detail, to why I think, my question add something, I will edit the question
Aug 27, 2019 at 12:35 review First posts
Aug 27, 2019 at 13:53
Aug 27, 2019 at 12:32 history asked Hamza Ince CC BY-SA 4.0