Re:Death by 1000 layers: the perils of over-abstraction in J...
by Hermel on Monday December 14, 2020 @09:27AM
(#25417877)
The problem is that unit testing as it is often done tears the object oriented design apart. The right way to do unit testing is to not test the internal state of an object in the test code, but to instead test it within the tested object using assertions. That way, running the unit test implicitly verifies the internal state of the object without having to expose it.
Re:Death by 1000 layers: the perils of over-abstraction in J...
by vbezhenar on Monday December 14, 2020 @06:16PM
(#25424719)
Usually people (ab)use default visibility modifier for unit testing. It's not public, so it's not visible from other packages, but unit tests usually reside in the same package, so you have full access to it.
But I agree that Java could use better unit test and mocking support.
Re:Death by 1000 layers: the perils of over-abstraction in J...
by an_opabinia on Monday December 14, 2020 @08:09PM
(#25425777)
Split modules are horrible.
As it stands, the necessity to relax members to `public` all over the place drives a giant bulldozer through any remaining delusions that Java is a language where actual OOP can be achieved.