Ejemplo n.º 1
0
  @Test
  public void shouldShowPasswordsInDescribeAsStars() throws IOException {
    HashMap<String, String> map = new HashMap<String, String>();
    map.put("password1", "secret");
    map.put("password2", "secret");
    CommandLine line =
        CommandLine.createCommandLine("echo")
            .withArg("My Password is:")
            .withEnv(map)
            .withArg(new PasswordArgument("secret"))
            .withArg(new PasswordArgument("new-pwd"));

    line.addInput(new String[] {"my pwd is: new-pwd "});
    assertThat(line.describe(), not(containsString("secret")));
    assertThat(line.describe(), not(containsString("new-pwd")));
  }