@Test
public void testPotOwnerFilterComplexExpression() {

    String userId = "userId";
    when(userGroupCallback.getGroupsForUser(userId)).thenReturn(null);
    when(identityProvider.getName()).thenReturn(userId);
    String potOwner = "potOwner";
    when(userGroupCallback.getGroupsForUser(potOwner)).thenReturn(Arrays.asList("role1", "role2"));
    List<String> potOwners = new ArrayList<String>();
    potOwners.add(potOwner);
    QueryParam queryParam = new QueryParam(COL_ID, "IN", potOwners);
    QueryParam queryParamTerm1 = new QueryParam("MY_COLUMN", "EQUALS_TO", Arrays.asList("1234"));
    QueryParam queryParamTerm2 = new QueryParam("MY_COLUMN", "NOT_IN", Arrays.asList(1, 2, 3, 4));
    QueryParam queryParamOR = new QueryParam(null, "OR", Arrays.asList(queryParamTerm1, queryParamTerm2, queryParam));
    CoreFunctionQueryParamBuilder coreFunctionQueryParamBuilder = new CoreFunctionQueryParamBuilder(queryParamOR);
    ColumnFilter columnFilter = (ColumnFilter) coreFunctionQueryParamBuilder.build();
    DataSetFilter filter = new DataSetFilter();
    filter.addFilterColumn(columnFilter);
    dataSetLookup.addOperation(filter);
    userAndGroupsTasksPreprocessor.preprocess(dataSetLookup);
    List<ColumnFilter> filters = dataSetLookup.getFirstFilterOp().getColumnFilterList();
    assertEquals(filters.size(), 2);
    assertEquals("(MY_COLUMN = 1234 OR MY_COLUMN not_in 1, 2, 3, 4)", filters.get(0).toString());
    assertEquals("(POTOWNER in role1, role2, " + potOwner + ")", filters.get(1).toString());
}