@Test
public void testUpdateSecurityZoneWithMisMatchId() throws Exception {

	RangerSecurityZone rangerSecurityZoneToUpdate = createRangerSecurityZone();
	Long securityZoneId = 2L;
	XXServiceDefDao xServiceDefDao = Mockito.mock(XXServiceDefDao.class);
	XXServiceDao xServiceDao = Mockito.mock(XXServiceDao.class);
	XXService xService = Mockito.mock(XXService.class);
	rangerSecurityZoneToUpdate.setId(securityZoneId);
	when(rangerBizUtil.isAdmin()).thenReturn(true);
	when(daoManager.getXXService()).thenReturn(xServiceDao);
	when(xServiceDao.findByName("test_service_1")).thenReturn(xService);
	when(daoManager.getXXServiceDef()).thenReturn(xServiceDefDao);
	when(xServiceDefDao.getById(xService.getType())).thenReturn(xServiceDef);
	when(validatorFactory.getSecurityZoneValidator(svcStore, securityZoneStore)).thenReturn(validator);
	doNothing().when(validator).validate(rangerSecurityZoneToUpdate, RangerValidator.Action.UPDATE);
	when(securityZoneStore.updateSecurityZoneById(rangerSecurityZoneToUpdate))
			.thenReturn(rangerSecurityZoneToUpdate);
	when(restErrorUtil.createRESTException(Mockito.anyString())).thenThrow(new WebApplicationException());
	thrown.expect(WebApplicationException.class);
	RangerSecurityZone updatedRangerSecurityZone = securityZoneREST.updateSecurityZone(9L,
			rangerSecurityZoneToUpdate);
	assertEquals(rangerSecurityZoneToUpdate.getId(), updatedRangerSecurityZone.getId());
	verify(validator, times(1)).validate(rangerSecurityZoneToUpdate, RangerValidator.Action.UPDATE);
}