public void testGrantedWriteForGroup() throws IOException, JSONException {
testGroupId = H.createTestGroup();
testUserId = H.createTestUser();
testFolderUrl = H.createTestFolder();
Credentials adminCreds = new UsernamePasswordCredentials("admin", "admin");
//add testUserId to testGroup
String groupPostUrl = HttpTest.HTTP_BASE_URL + "/system/userManager/group/" + testGroupId + ".update.html";
List<NameValuePair> groupPostParams = new ArrayList<NameValuePair>();
groupPostParams.add(new NameValuePair(":member", testUserId));
H.assertAuthenticatedPostStatus(adminCreds, groupPostUrl, HttpServletResponse.SC_OK, groupPostParams, null);
//assign some privileges
String postUrl = testFolderUrl + ".modifyAce.html";
List<NameValuePair> postParams = new ArrayList<NameValuePair>();
postParams.add(new NameValuePair("principalId", testGroupId));
postParams.add(new NameValuePair("privilege@jcr:read", "granted"));
postParams.add(new NameValuePair("privilege@jcr:write", "granted"));
postParams.add(new NameValuePair("privilege@jcr:readAccessControl", "granted"));
postParams.add(new NameValuePair("privilege@jcr:modifyAccessControl", "granted"));
H.assertAuthenticatedPostStatus(adminCreds, postUrl, HttpServletResponse.SC_OK, postParams, null);
String getUrl = testFolderUrl + ".privileges-info.json";
//fetch the JSON for the test page to verify the settings.
Credentials testUserCreds = new UsernamePasswordCredentials(testUserId, "testPwd");
String json = H.getAuthenticatedContent(testUserCreds, getUrl, HttpTest.CONTENT_TYPE_JSON, null, HttpServletResponse.SC_OK);
assertNotNull(json);
JSONObject jsonObj = new JSONObject(json);