I add two lines to assert:
assertTrue((ex.getMessage().contains("Error compiling query")));
assertTrue((ex.getMessage().contains("PlanningErrorException")));

Should this will help us identify the real reason to let it fail?