}
void checkMandatoryProperties() {
+ StringBuilder missing = new StringBuilder();
for (String mandatoryProperty : MANDATORY_PROPERTIES) {
if (!properties.containsKey(mandatoryProperty)) {
- throw new RunnerException("You must define mandatory property: " + mandatoryProperty);
+ if (missing.length() > 0) {
+ missing.append(", ");
+ }
+ missing.append(mandatoryProperty);
}
}
+ if (missing.length() != 0) {
+ throw new RunnerException("You must define mandatory properties: " + missing);
+ }
}
public String getServerURL() {
Runner.create(new Properties()).checkMandatoryProperties();
fail();
} catch (RunnerException e) {
- assertThat(e.getMessage(), is("You must define mandatory property: sonar.projectKey"));
+ assertThat(e.getMessage(), is("You must define mandatory properties: sonar.projectKey, sonar.projectName, sonar.projectVersion, sources"));
}
}