System.setIn(simulatedInputStream);
Bootstrap bootstrap = new Bootstrap();
JLineShellComponent shell = bootstrap.getJLineShellComponent();
assertThat(simulatedInputStream.isReadPerformed(), is(false));
assertThat(simulatedInputStream.hasUnreadData(), is(true));
CommandResult commandResult = shell.executeCommand("admin config server --uri http://localhost:" + adminPort + " --username admin");
assertThat(simulatedInputStream.isReadPerformed(), is(false)); // without the --password flag, the shell doesn't prompt and doesn't read from input
assertThat(simulatedInputStream.hasUnreadData(), is(true));
assertThat(commandResult.isSuccess(), is(true));
Configuration configuration = bootstrap.getApplicationContext().getBean(Configuration.class);
assertThat(configuration.getTarget().getTargetException(), instanceOf(HttpClientErrorException.class));