Three steps to getting a component displayed (assuming that there is a subclass of JPanel being used):
1) add a reference to the component to the subComponent
assertNotNull(container.subComponent);
2) Check that the component has the right stuff
assertEquals(“expected text”, container.subCompoent.getText());
etc…
3) Check that the component is going to be visible on the screen
assertEquals(container, container.subComponent.getParent()).
In practice for me I have added another panel to the containment hierarchy in order to use a JGoodies builder to do the laying out. This means that I have made the assert:
assertEquals(container.jgoodiesPanel, container.subComponent.getParent()).
I have also got an assertion that looks like this:
assertEquals(container, container.jgoodiesPanel.getParent()).
This ensures my JGoodies panel is made visible.
After doing this I can do the visual check to make sure it performs as expected. Which it does
.





