}
/**
- * Answers a string description of this matcher, suitable for debugging or
- * logging. The format may change in future.
+ * Answers a string description of this matcher, suitable for display, debugging
+ * or logging. The format may change in future.
*/
@Override
public String toString()
{
StringBuilder sb = new StringBuilder();
sb.append(String.join(COLON, key)).append(" ")
- .append(matcher.getCondition().toString()).append(" ");
- if (matcher.getCondition().isNumeric())
+ .append(matcher.getCondition().toString());
+ Condition condition = matcher.getCondition();
+ if (condition.isNumeric())
{
- sb.append(matcher.getPattern());
+ sb.append(" ").append(matcher.getPattern());
}
- else
+ else if (condition != Condition.Present
+ && condition != Condition.NotPresent)
{
- sb.append("'").append(matcher.getPattern()).append("'");
+ sb.append(" '").append(matcher.getPattern()).append("'");
}
return sb.toString();