@SuppressWarnings("unchecked")
@Test
public void testGetPoliciesCombinedAsPolicySet_Fail_By_Throwing_InvalidPolicyCombiningAlgIdException()
		throws Exception {

	// Arrange
	final String policyId = "policyId";
	final String policySet = "policySet";
	final String policySetId = "policySetId";
	final boolean policySetValid = true;
	final String policyCombiningAlgId = "policyCombiningAlgId";
	final String wildcard = "wildcard";
	final PolicyDto getPoliciesCombinedAsPolicySetResponseDto = new PolicyDto();
	getPoliciesCombinedAsPolicySetResponseDto.setId(policySetId);
	getPoliciesCombinedAsPolicySetResponseDto.setValid(policySetValid);
	getPoliciesCombinedAsPolicySetResponseDto.setPolicy(policySet
			.getBytes(DEFAULT_ENCODING));
	final String uri = API + "/policies/" + policyId + "/combined";
	when(
			policyService.getPoliciesCombinedAsPolicySet(policyId,
					wildcard, policySetId, policyCombiningAlgId))
			.thenThrow(InvalidPolicyCombiningAlgIdException.class);
	// Act and Assert
	mockMvc.perform(
			get(uri).contentType(APPLICATION_JSON_UTF8)
					.param("wildcard", wildcard)
					.param("policySetId", policySetId)
					.param("policyCombiningAlgId", policyCombiningAlgId))
			.andExpect(status().isBadRequest());
	// Assert
	verify(policyService, times(1)).getPoliciesCombinedAsPolicySet(
			policyId, wildcard, policySetId, policyCombiningAlgId);
}