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

	// Arrange
	final String policyId = "policyId";
	final boolean valid = true;
	final String policy = "policy";
	final String uri = API + "/policies/" + policyId;
	final PolicyContentDto updatePolicyRequestDto = new PolicyContentDto();
	updatePolicyRequestDto.setPolicy(policy.getBytes(DEFAULT_ENCODING));
	final PolicyMetadataDto updatePolicyResponseDto = new PolicyMetadataDto();
	updatePolicyResponseDto.setId(policyId);
	updatePolicyResponseDto.setValid(valid);
	when(
			policyService.updatePolicy(any(PolicyContentDto.class),
					eq(policyId))).thenThrow(PolicyNotFoundException.class);
	// Act and Assert
	mockMvc.perform(
			put(uri).contentType(APPLICATION_JSON_UTF8).content(
					convertObjectToJsonBytes(updatePolicyRequestDto)))
			.andExpect(status().isNotFound());
	// Assert
	verify(policyService, times(1))
			.updatePolicy(
					argThat(matching((PolicyContentDto req) -> policy
							.equals(bytesToString(req)))),
					eq(policyId));
}