@Test(expected = ValidationServiceException.class)
  public void testMergeAddNotDelegatable() {
    RoleDO delegatable = new RoleDO();
    delegatable.setRoleId(Long.valueOf(2));
    delegatable.setName("delgatable");

    Mockito.when(roleDAO.findDelegatableRoles(any(Long.class), any(Long.class)))
        .thenReturn(Lists.<RoleDO>newArrayList());
    Mockito.when(roleDAO.findRolesByCode(any(Long.class), any(List.class)))
        .thenReturn(Lists.newArrayList(delegatable));
    Mockito.when(userDAO.getById(Long.valueOf(5))).thenReturn(new UserDO());
    try {
      ServiceContext context = new ServiceContext();
      User user = new User();
      user.setUserId(Long.valueOf(5));
      context.setUser(user);
      userRoleService.mergeUserRoles(context, Long.valueOf(1), Lists.<String>newArrayList("foo"));
    } finally {
      Mockito.verify(userRoleDAO, Mockito.never()).persist(any(UserRoleDO.class));
    }
  }