private void testFieldNames(Map<String, String> properties,
String propertyName, String[] propertyValues, String expectedValue,
String bundleMessage) {
StringBuilder errors = new StringBuilder();
for (String propertyValue : propertyValues) {
ConfigureResponse configRes =
validateConfig(properties, propertyName, propertyValue);
if (configRes.getMessage() != null
|| configRes.getFormSnippet() != null) {
errors.append(propertyName + "=" + propertyValue + ": "
+ configRes.getMessage() + "\n");
} else if (expectedValue != null
&& !configRes.getConfigData().get(propertyName).equals(
expectedValue)) {
errors.append(propertyName + "=" + propertyValue + ": expected:<" +
expectedValue + "> but was:<"
+ configRes.getConfigData().get(propertyName) + ">\n");
}
}
ConfigureResponse configRes =
validateConfig(properties, propertyName, INVALID_FIELD_NAME);
if (configRes.getMessage() == null) {
errors.append(propertyName + "=" + INVALID_FIELD_NAME
+ ": Unexpected null\n");
} else if (!configRes.getMessage().equals(
BUNDLE.getString(bundleMessage))) {
errors.append(propertyName + "=" + INVALID_FIELD_NAME + ": "
+ configRes.getMessage() + "\n");
}
if (errors.length() > 0) {
fail(errors.toString());
}