title: How to unit-test single Swing Component with AssertJ?
body: <p>Are there any examples on how to test single Component or JComponent with AssertJ?</p>
  
  <p><a href="http://joel-costigliola.github.io/assertj/assertj-swing-getting-started.html" rel="noreferrer">Getting started guide</a> shows strange example to test entire application with main class, which is no granulated enough. I am expecting to test custom components first.</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Suppose I have the following component:</p>
  
  <pre><code>package tests;
  
  import javax.swing.*;
  import java.awt.*;
  
  public class JCustomPanel extends JPanel {
      @Override
      public void paint(Graphics g) {
          super.paint(g);
          g.setColor(Color.RED);
          g.fillRect(0, 0, getWidth(), getHeight());
      }
  }
  </code></pre>
  
  <p>and I wish to check if it appears red. What to write?</p>
  
  <pre><code>package tests;
  
  import org.assertj.swing.edt.FailOnThreadViolationRepaintManager;
  import org.assertj.swing.fixture.JPanelFixture;
  import org.assertj.swing.testing.AssertJSwingTestCaseTemplate;
  import org.junit.Before;
  import org.junit.BeforeClass;
  import org.junit.Test;
  
  public class Test01 extends AssertJSwingTestCaseTemplate {
  
      private JPanelFixture panel;
  
      @BeforeClass
      public static void setUpOnce() {
          FailOnThreadViolationRepaintManager.install();
      }
  
      @Before
      public void setUp() {
          panel = new JPanelFixture(robot(), new JCustomPanel());
      }
  
      @Test
      public void testColorIsRed() {
          //what to write here?
      }
  }
  </code></pre>