Source:
public void testEnableLetsEncryptSSLInteractiveDeclineTOS() throws Exception { CliProcessWrapper cli = new CliProcessWrapper(). addJavaOption("-Duser.home=" + temporaryUserHome.getRoot().toPath().toString()). addCliArgument("--controller=remote+http://" + TestSuiteEnvironment.getServerAddress() + ":" + TestSuiteEnvironment.getServerPort()). addCliArgument("--connect"); try { cli.executeInteractive(); cli.clearOutput(); Assert.assertTrue(cli.pushLineAndWaitForResults("security enable-ssl-management --interactive --no-reload --lets-encrypt", "File name (default accounts.keystore.jks)")); Assert.assertTrue(cli.pushLineAndWaitForResults(ACCOUNTS_KEYSTORE_FILE_NAME, "Password (blank generated):")); Assert.assertTrue(cli.pushLineAndWaitForResults(ACCOUNTS_KEYSTORE_PASSWORD, "Account name (default CertAuthorityAccount)")); Assert.assertTrue(cli.pushLineAndWaitForResults(CA_ACCOUNT_NAME, "Contact email(s)")); Assert.assertTrue(cli.pushLineAndWaitForResults("admin@example.com", "Password (blank generated):")); Assert.assertTrue(cli.pushLineAndWaitForResults(ACCOUNTS_KEYSTORE_PASSWORD, "Alias")); Assert.assertTrue(cli.pushLineAndWaitForResults(CA_ACCOUNT_ALIAS, "Certificate authority URL (default "+ certificateAuthority.getUrl() +"):")); Assert.assertTrue(cli.pushLineAndWaitForResults(LOCALHOST_ACME_URL, "Do you agree to Let's Encrypt terms of service? y/n:")); Assert.assertTrue(cli.pushLineAndWaitForResults("n", null)); } catch (Throwable ex) { throw new Exception(cli.getOutput(), ex); } finally { cli.destroyProcess(); } }

Target:
public void testEnableLetsEncryptSSLInteractiveDeclineTOS() throws Exception { CliProcessWrapper cli = new CliProcessWrapper(). addJavaOption("-Duser.home=" + temporaryUserHome.getRoot().toPath().toString()). addCliArgument("--controller=remote+http://" + TestSuiteEnvironment.getServerAddress() + ":" + TestSuiteEnvironment.getServerPort()). addCliArgument("--connect"); try { cli.executeInteractive(); cli.clearOutput(); Assert.assertTrue(cli.pushLineAndWaitForResults("security enable-ssl-management --interactive --no-reload --lets-encrypt", "File name (default accounts.keystore.jks)")); Assert.assertTrue(cli.pushLineAndWaitForResults(ACCOUNTS_KEYSTORE_FILE_NAME, "Password (blank generated):")); Assert.assertTrue(cli.pushLineAndWaitForResults(ACCOUNTS_KEYSTORE_PASSWORD, "Account name (default CertAuthorityAccount)")); Assert.assertTrue(cli.pushLineAndWaitForResults(CA_ACCOUNT_NAME, "Contact email(s)")); Assert.assertTrue(cli.pushLineAndWaitForResults("admin@example.com", "Password (blank generated):")); Assert.assertTrue(cli.pushLineAndWaitForResults(ACCOUNTS_KEYSTORE_PASSWORD, "Alias")); Assert.assertTrue(cli.pushLineAndWaitForResults(CA_ACCOUNT_ALIAS, "Certificate authority URL (default "+ certificateAuthority.getUrl() +"):")); Assert.assertTrue(cli.pushLineAndWaitForResults(LOCALHOST_ACME_URL, "Do you agree to Let's Encrypt terms of service? y/n:")); Assert.assertTrue(cli.pushLineAndWaitForResults("n", null)); Assert.assertTrue(cli.getOutput().contains("Ignoring, command not executed. You need to accept the TOS to create account and obtain certificates.")); } catch (Throwable ex) { throw new Exception(cli.getOutput(), ex); } finally { cli.destroyProcess(); } }