Added missing testcase, part of RM-2343. Test ensures that whitespace-only values for 'classified by' result in a 4xx HTTP response.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@108248 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Neil McErlean
2015-07-14 11:43:10 +00:00
parent 71565ff47a
commit d5f4ecaa35
2 changed files with 65 additions and 11 deletions

View File

@@ -343,4 +343,28 @@ public final class WebScriptUtils
return jsonArray;
}
/**
* Returns {@code true} if the provided {@link WebScriptException}
* represents an HTTP 4xx error, else {@code false}.
*/
public static boolean is4xxError(WebScriptException e)
{
return isStatusInRange(e, 400, 500);
}
/**
* Returns {@code true} if the provided {@link WebScriptException}
* represents an HTTP 5xx error, else {@code false}.
*/
public static boolean is5xxError(WebScriptException e)
{
return isStatusInRange(e, 500, 600);
}
private static boolean isStatusInRange(WebScriptException e, int lowerLimitInclusive, int upperLimitExclusive)
{
final int status = e.getStatus();
return status >= lowerLimitInclusive && status < upperLimitExclusive;
}
}