ExportPDF { public static final void save(File file, Component c) { save(file, c, c.getWidth(), c.getHeight()); }  static final File selectFile(); static final File selectFile(Component c); static final void save(File file, Component c); static final void save(File file, Component c, int width, int height);  }
@Test public void testExport() throws IOException { JButton b = new JButton("test"); b.setSize(100, 100); File file = File.createTempFile("itext-text", ".pdf"); ExportPDF.save(file, b); assertTrue(file.exists()); assertTrue(file.length() > 0); file.delete(); assertFalse(file.exists()); }