Created
August 8, 2019 04:13
-
-
Save thieunguyenhung/0ee59a317a848ef28470aed9ae882515 to your computer and use it in GitHub Desktop.
Testing class for QR code to SVG
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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