QRCodeGenerator { public void writeToOutputStream(OutputStream os) { generateQRCode().writeTo(os); }  QRCodeGenerator setVCard(VCard card); QRCodeGenerator setImageType(ImageType type); QRCodeGenerator setCompany(String company); QRCodeGenerator setEMail(String email); QRCodeGenerator setAddress(String address); QRCodeGenerator setName(String name); QRCodeGenerator setPhone(String phone); QRCodeGenerator seTitle(String title); QRCodeGenerator setUrl(URL url); QRCodeGenerator setWidth(int w); QRCodeGenerator setHeight(int h); File generateToFile(); void writeToOutputStream(OutputStream os);  }
@Test public void testWriteToOutputStream() throws IOException, URISyntaxException { System.out.println("testWriteToOutputStream"); QRCodeGenerator instance = new QRCodeGenerator().setUrl(new URL("https: File result = File.createTempFile(String.valueOf((new Date()).getTime()), "deleteme"); result.deleteOnExit(); OutputStream os = null; try { os = new FileOutputStream(result); instance.writeToOutputStream(os); } finally { IOUtils.closeQuietly(os); } assertNotNull(result); assertTrue(result.exists()); assertNotEquals(0, result.length()); }