title: junit testing overridden paint component
body: <p>I am having problem testing my overridden paint components.</p>
  
  <p>I have removed a lot the code to simplify things</p>
  
  <pre><code> @Override
      protected void paintComponent(Graphics g) {
                  g.setColor(Color.RED);
                  int y = //some come;
                  int height = //some code
                  //for loop
                  g.clearRect(1, y, getWidth(), height);
                  g.drawRect(1, y, getWidth(), height);
              }
          }
          super.paintComponent(g);
      }
  </code></pre>
  
  <p>My paint component creates multiple rectangles. I need to get details on the number of rectangles drawn and their height. I'm not sure how to make a unit test to do this.</p>
  
  <p>I've tried to use the TextAreas' <code>getComponents()</code> method but it returns null. I thought calling repaint() would trigger the paint component to execute.</p>
  
  <p>Thanks for any help</p>