I have a problem, I have written a class, inside another class. No problem with that, but I have now come to develop a unit test for the outer class. The JUnit must be able to test the methods of the inner class as well as all other class methods. However, I can not seem to access the methods, or even reference the class.

Please can someone point me in the correct direction.


8 Years
Discussion Span
Last Post by FallenPaladin

Why do you need to write tests that don't adhere to the access scope of the inner class? If it's not a static inner class, you should have an instance of the enclosing class to work from. If that's not the case, then perhaps your inner class should actually be a public top-level class?


Hi there, the class functions perfectly, and the app as well. the class was made for the sol purpose of that JFrame, as such it was easier to make it a nested class.

However, I have now solved the problem. Thank you.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.