@Test
	public void testShellWithPasswordFlag() 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 --password");
			assertThat(simulatedInputStream.isReadPerformed(), is(true));
			assertThat(simulatedInputStream.hasUnreadData(), is(false));
			assertThat(commandResult.isSuccess(), is(true));
			commandResult = shell.executeCommand("module list");
			assertThat(commandResult.isSuccess(), is(true));
			assertThat(commandResult.getResult(), instanceOf(Table.class));
			assertThat(((Table) commandResult.getResult()).getHeaders().size(), greaterThan(0));
		}
		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