Arrow2D extends Line2D.Float { public void draw(final Graphics2D g2d) { draw(g2d, (int) x1, (int) y1, (int) x2, (int) y2); } Arrow2D();  Arrow2D(final float x1, final float y1, final float x2, final float y2);  Arrow2D(final Point2D p1, final Point2D p2); void draw(final Graphics2D g2d); static void draw(final Graphics2D g2d, final int x1, final int y1, final int x2, final int y2);  }
@Test public void testArrowDraw() throws InterruptedException { CountDownLatch latch = new CountDownLatch(1); CountDownLatch closeLatch = new CountDownLatch(1); SwingUtilities.invokeLater(() -> { JFrame frame = new JFrame("Arrow"); frame.add(new JPanel() { @SuppressFBWarnings("BC_UNCONFIRMED_CAST") public void paintComponent(final Graphics g) { new Arrow2D(0, 0, 100, 100).draw((Graphics2D) g); } }, BorderLayout.CENTER); frame.setSize(800, 400); frame.addWindowListener(new LatchWindowCloseListener(closeLatch)); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); frame.setVisible(true); latch.countDown(); }); Assert.assertTrue(latch.await(10, TimeUnit.SECONDS)); if (TestUtils.isExecutedFromIDE()) { Assert.assertTrue(closeLatch.await(1, TimeUnit.HOURS)); } }