@Test
  public void testGetSearchClauseValuesPresentParamsNull() throws Exception {
    final String searcherId = "searcherId";

    final FieldValuesHolderImpl valuesHolder = new FieldValuesHolderImpl();
    valuesHolder.put(searcherId, null);

    final VersionCustomFieldSearchInputTransformer transformer =
        new VersionCustomFieldSearchInputTransformer(
            searcherId,
            new ClauseNames("clauseName"),
            mockController.getMock(CustomField.class),
            mockController.getMock(VersionIndexInfoResolver.class),
            mockController.getMock(JqlOperandResolver.class),
            mockController.getMock(FieldFlagOperandRegistry.class),
            searchContextVisibilityChecker,
            versionResolver,
            customFieldInputHelper,
            versionManager) {
          @Override
          protected Clause getClauseFromParams(
              final User searcher,
              final CustomFieldParams params,
              final FieldValuesHolder fieldValuesHolder) {
            fail("Should not have been called");
            return null;
          }
        };

    mockController.replay();

    assertNull(transformer.getSearchClause(null, valuesHolder));

    mockController.verify();
  }
  @Test
  public void testGetSearchClauseValuesPresentParamsNotEmpty() throws Exception {
    final String searcherId = "searcherId";
    final String clauseName = "clauseName";

    final CustomFieldParamsImpl customFieldParams = new CustomFieldParamsImpl();
    customFieldParams.addValue(Collections.singleton("dontcare"));

    final FieldValuesHolderImpl valuesHolder = new FieldValuesHolderImpl();
    valuesHolder.put(searcherId, customFieldParams);

    final AtomicBoolean wasCalled = new AtomicBoolean(false);
    final Clause expectedClause = new TerminalClauseImpl(clauseName, Operator.EQUALS, "blah");

    final VersionCustomFieldSearchInputTransformer transformer =
        new VersionCustomFieldSearchInputTransformer(
            searcherId,
            new ClauseNames(clauseName),
            mockController.getMock(CustomField.class),
            mockController.getMock(VersionIndexInfoResolver.class),
            mockController.getMock(JqlOperandResolver.class),
            mockController.getMock(FieldFlagOperandRegistry.class),
            searchContextVisibilityChecker,
            versionResolver,
            customFieldInputHelper,
            versionManager) {
          @Override
          protected Clause getClauseFromParams(
              final User searcher,
              final CustomFieldParams params,
              final FieldValuesHolder fieldValuesHolder) {
            wasCalled.set(true);
            return expectedClause;
          }
        };

    mockController.replay();

    assertEquals(expectedClause, transformer.getSearchClause(null, valuesHolder));
    assertTrue(wasCalled.get());

    mockController.verify();
  }