@Test
public void testGetPoliciesCombinedAsPolicySet()
		throws UnsupportedEncodingException {

	// Arrange
	final String policyId = "C2S*";
	final String wildcard = "*";
	final String policyCombiningAlgId = "permit-overrides";
	final String policyCombiningAlgIdReturned = "urn:oasis:names:tc:xacml:1.0:policy-combining-algorithm:permit-overrides";
	final PolicyServiceImpl spy = spy(sut);
	final PolicyContainerDto getPolicyResponseContainerDto = new PolicyContainerDto();
	final PolicyDto p1 = new PolicyDto();
	p1.setId(POLICY_ID1);
	p1.setPolicy(POLICY_STRING1.getBytes("UTF-8"));
	p1.setValid(true);
	final PolicyDto p2 = new PolicyDto();
	p2.setId(POLICY_ID2);
	p2.setPolicy(POLICY_STRING2.getBytes("UTF-8"));
	p1.setValid(true);
	getPolicyResponseContainerDto.setPolicies(Arrays.asList(p1, p2));
	doReturn(getPolicyResponseContainerDto).when(spy).getPolicies(policyId,
			wildcard);
	when(
			policyCombiningAlgIdValidator
					.validateAndReturn(policyCombiningAlgId)).thenReturn(
			policyCombiningAlgIdReturned);
	// Act
	final PolicyDto response = spy.getPoliciesCombinedAsPolicySet(policyId,
			wildcard, null, policyCombiningAlgId);
	// Assert
	assertNotNull(response.getPolicy());
	assertTrue(StringUtils.hasText(getNode(
			bytesToDocument(response.getPolicy()),
			XACMLXPath.XPATH_POLICY_SET_ID).get().getNodeValue()));
	assertEquals(
			policyCombiningAlgIdReturned,
			getNode(bytesToDocument(response.getPolicy()),
					XACMLXPath.XPATH_POLICY_SET_POLICY_COMBINING_ALG_ID)
					.get().getNodeValue());
}