A very fine idea for naming and nesting unit tests:
To have a nested class for each method being tested.
Sources:
- http://haacked.com/archive/2012/01/01/structuring-unit-tests.aspx
- http://zendeveloper.blogspot.com/2012/01/structuring-unit-tests.html
This little trick, this one simple sentence, is like a missing piece in the jigsaw. I liked it from the very start. It fits very well alongside guides for naming of testing methods, like expressed in this article:
http://blog.stevensanderson.com/2009/08/24/writing-great-unit-tests-best-and-worst-practises/
I just wonder how this practice could fit into JUnit. Will have to try.