Skip to content

Instantly share code, notes, and snippets.

@thieunguyenhung
Created August 8, 2019 04:13
Show Gist options
  • Save thieunguyenhung/0ee59a317a848ef28470aed9ae882515 to your computer and use it in GitHub Desktop.
Save thieunguyenhung/0ee59a317a848ef28470aed9ae882515 to your computer and use it in GitHub Desktop.
Testing class for QR code to SVG
public File generate() throws IOException, WriterException {
BitMatrix bitMatrix = createBitMatrix("https://medium.com/@thieunguyenhung", 100);
File outputFileSVG = File.createTempFile("example", "qr.svg");
bitMatrixToSVG(bitMatrix, outputFileSVG);
return outputFileSVG;
}
// .....
public class TestQrCodeGenerator {
@Test
public void should_return_non_null_file() throws IOException, WriterException {
QrCodeGenerator qrCodeGenerator = new QrCodeGenerator();
File qrFile = qrCodeGenerator.generate();
assertNotNull(qrFile);
System.out.println(qrFile.getAbsolutePath()); // Print to console the path to the SVG file
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment