return buffer.toString();
}
protected String verifyLocation(Rect mainArea, Rect secondArea, Location location, PageValidation pageValidation, T spec) {
List<String> messages = new LinkedList<String>();
Range range;
try {
range = pageValidation.convertRange(location.getRange());
}
catch (Exception ex) {
return format("Cannot convert range: " + ex.getMessage());
}
for (Side side : location.getSides()) {
int offset = getOffsetForSide(mainArea, secondArea, side, spec);
if (!range.holds(offset)) {
messages.add(format("%dpx %s", offset, side));
}
}
if (messages.size() > 0) {
StringBuffer buffer = new StringBuffer();
boolean comma = false;
for (String message : messages) {
if (comma) {
buffer.append(" and ");
}
buffer.append(message);
comma = true;
}
buffer.append(' ');
buffer.append(range.getErrorMessageSuffix());
return buffer.toString();
}
else return null;
}