mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
RM-2120: Add error handling (and test) as suggested by Neil during + review RM-46
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@104157 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -117,4 +117,25 @@ public class UserSecurityClearancePutUnitTest extends BaseWebScriptUnitTest
|
||||
// Execute web script - this should throw the expected exception.
|
||||
executeJSONWebScript(parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the Security Clearance webscript can't be called by a user with insufficient clearance
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test(expected = WebScriptException.class)
|
||||
public void testIncorrectClearanceId() throws Exception
|
||||
{
|
||||
String username = "user1";
|
||||
String clearanceId = "ThisClearanceDoesNotExist";
|
||||
|
||||
// Setup web script parameters
|
||||
Map<String, String> parameters = buildParameters(USERNAME, username, CLEARANCE_ID, clearanceId);
|
||||
|
||||
when(mockSecurityClearanceService.setUserSecurityClearance(username, clearanceId)).thenThrow(
|
||||
new ClassificationServiceException.LevelIdNotFound(clearanceId));
|
||||
|
||||
// Execute web script - this should throw the expected exception.
|
||||
executeJSONWebScript(parameters);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user