I’m faced with a problem on how to cover methods of my innner classes. I have a small GUI (swing) application with several buttons and defined action listeners in form of inner classes. Now I want to write tests for each of the action listener methods defined in these inner classes but when I’m creating a new JUnit using Eclipse I don’t have a option to cover methods of inner classes but the only public methods of the Class where those inners are defined. Please advice.
Share
Conceptually, inner methods are not generally tested with unit tests, because they are considered an implementation detail. You should be testing the behavior of your class by testing its public methods.
That said…
http://www.artima.com/suiterunner/private.html
I’m not sure why you need inner classes…They’re not used anywhere else? Why not just make them public classes outside of your main class?