MfaRegisterQRGenerator { public static String getQRCodePngDataUri(String issuer, String accountName, String secretKey) throws WriterException, IOException { return "data:image/png;base64," + getQRCode(issuer, accountName, secretKey); }  static String getQRCode(String issuer,
                                   String accountName,
                                   String secretKey); static String getQRCodePngDataUri(String issuer,
                                      String accountName,
                                      String secretKey);  }
@Test public void testPngUrl() throws Exception { GoogleAuthenticator authenticator = new GoogleAuthenticator(); GoogleAuthenticatorKey key = authenticator.createCredentials(); String encodedQrCode = MfaRegisterQRGenerator.getQRCodePngDataUri("testIssuer", "accountName", key.getKey()); assertTrue(encodedQrCode.startsWith("data:image/png;base64,")); String rawSplit = encodedQrCode.split(",")[1]; String[] split = decodeQrPng(rawSplit).split("\\?"); assertEquals("otpauth: List<String> list = Arrays.asList(split[1].split("&")); assertTrue("url did not contain issuer", list.contains("issuer=testIssuer")); assertTrue("url did not contain secret", list.contains("secret=" + key.getKey())); assertEquals(2, list.size()); }