@Test
public void test_isAuthorized_safeOwner_withcapabilitycheck_success_list_policies() throws Exception {

	String username = "normaluser";
	String powerToken = "self_support_token";
	String userToken = "ordinary_client_token";
	boolean admin = false;
	String safename = "mysafe01";
	String safeType = "shared";
	String safeOwner = "owner@someorg.com";
	String safeOwnerId = "normaluser";
	String path = "shared/mysafe01";
	String latestPoliciesStr = "s_shared_mysafe01, safeadmin";
	String policiesTobeCheckedStr = "s_shared_mysafe01";
	boolean forceCapabilityCheck = true;
	UserDetails userDetails = createUserDetails(username, powerToken, userToken, admin);
	Safe safeMetaData = createSafe(safename, safeType, path, safeOwner, safeOwnerId);
	String[] latestPolicies = createLatestPolicies(latestPoliciesStr);
	ArrayList<String> policiesTobeChecked = createPoliciesTobeChecked(policiesTobeCheckedStr);
	LinkedHashMap<String, Object> capRes = new LinkedHashMap<String, Object>();
	LinkedHashMap<String, Object> pathsMap = new LinkedHashMap<String, Object>();
	LinkedHashMap<String, Object> capPathMap = new  LinkedHashMap<String, Object>();
	LinkedHashMap<String, Object> capMap = new  LinkedHashMap<String, Object>();
	List<String> policies = new ArrayList<>();
	policies.add("create");
	capMap.put("policy", policies);
	capPathMap.put("metadata/shared/s1/*", capMap);
	capPathMap.put("shared/s1/*", capMap);
	pathsMap.put("path", capPathMap);
	capRes.put("name", "s_shared_s1");
	capRes.put("rules", getJSON(pathsMap));
	String expectedBody = getJSON(capRes);
	Response capabilitiesResponse = getMockResponse(HttpStatus.OK, true, expectedBody);
	when(reqProcessor.process("/access","{\"accessid\":\""+"s_shared_mysafe01"+"\"}",powerToken)).thenReturn(capabilitiesResponse);
	boolean actual = authorizationUtils.isAuthorized(userDetails, safeMetaData, latestPolicies, policiesTobeChecked, forceCapabilityCheck);
	assertEquals(actual, true);
}