public static Properties parseArguments(String[] args) {
    Properties props = argumentsToProperties(args);

    // complete with only the system properties that start with "sonar."
    for (Map.Entry<Object, Object> entry : System.getProperties().entrySet()) {
      String key = entry.getKey().toString();
      if (key.startsWith("sonar.")) {
        props.setProperty(key, entry.getValue().toString());
      }
    }
    return props;
  }
@Test
  public void parseArguments() {
    System.setProperty("CommandLineParserTest.unused", "unused");
    System.setProperty("sonar.CommandLineParserTest.used", "used");

    Properties p = CommandLineParser.parseArguments(new String[] {"-Dsonar.foo=bar"});

    // test environment can already declare some system properties prefixed by "sonar."
    // so we can't test the exact number "2"
    assertThat(p.size()).isGreaterThanOrEqualTo(2);
    assertThat(p.getProperty("sonar.foo")).isEqualTo("bar");
    assertThat(p.getProperty("sonar.CommandLineParserTest.used")).isEqualTo("used");

  }