@Test
  public void testSanitiseOperandDoesNotChange() throws Exception {
    final SearchHandlerManager manager = mockController.getMock(SearchHandlerManager.class);

    final SingleValueOperand inputOperand = new SingleValueOperand("HSP");
    final TerminalClause clause = new TerminalClauseImpl("project", Operator.EQUALS, inputOperand);

    final JqlOperandResolver jqlOperandResolver = mockController.getMock(JqlOperandResolver.class);

    final DefaultOperandSanitisingVisitor operandVisitor =
        new DefaultOperandSanitisingVisitor(jqlOperandResolver, theUser) {
          @Override
          public Operand visit(final SingleValueOperand singleValueOperand) {
            assertEquals(inputOperand, singleValueOperand);
            return singleValueOperand;
          }
        };

    final ClauseSanitisingVisitor visitor =
        new ClauseSanitisingVisitor(manager, jqlOperandResolver, theUser) {
          @Override
          DefaultOperandSanitisingVisitor createOperandVisitor(final User user) {
            return operandVisitor;
          }
        };

    mockController.replay();

    final Clause result = visitor.sanitiseOperands(clause);
    assertSame(result, clause);

    mockController.verify();
  }
  @Test
  public void testSanitiseChildren() throws Exception {
    final SearchHandlerManager manager = mockController.getMock(SearchHandlerManager.class);
    final Clause childClause = mockController.getMock(Clause.class);

    final JqlOperandResolver jqlOperandResolver = mockController.getMock(JqlOperandResolver.class);

    ClauseSanitisingVisitor visitor =
        new ClauseSanitisingVisitor(manager, jqlOperandResolver, null);
    EasyMock.expect(childClause.accept(visitor)).andReturn(childClause);

    mockController.replay();

    AndClause andClause = new AndClause(childClause);

    final List<Clause> sanitisedChildren = visitor.sanitiseChildren(andClause);
    assertEquals(1, sanitisedChildren.size());
    assertEquals(childClause, sanitisedChildren.get(0));

    mockController.verify();
  }