@Test
	public void testShellNoPromptWithoutPasswordFlag() throws Exception {
		try {
			// Simulate user input by replacing the system input stream
			SimulatedInputStream simulatedInputStream = new SimulatedInputStream("whosThere\n");
			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));
			assertThat(((HttpClientErrorException) configuration.getTarget().getTargetException()).getStatusCode(),
					equalTo(HttpStatus.UNAUTHORIZED));
			commandResult = shell.executeCommand("module list");
			assertThat(commandResult.isSuccess(), is(false));
		}
		finally {
			// restore the system input stream
			System.setIn(System.in);
		}
	}
Tests basic security support in the shell.

@author Marius Bogoevici
spring-xd-shell/src/test/java/org/springframework/xd/shell/security/SecuredShellAccessTests.java