@Test
  public void testGetClauseFromParamsValuesGetFiltered() throws Exception {
    final String clauseName = "clauseName";

    final CustomField customField = mockController.getMock(CustomField.class);
    EasyMock.expect(customField.getName()).andStubReturn("ABC");
    EasyMock.expect(customFieldInputHelper.getUniqueClauseName(theUser, clauseName, "ABC"))
        .andStubReturn(clauseName);

    final CustomFieldParamsImpl customFieldParams = new CustomFieldParamsImpl();
    customFieldParams.addValue(CollectionBuilder.newBuilder("55", "-1", "").asMutableSet());

    final Set<String> expectedFilteredValues = CollectionBuilder.newBuilder("55").asMutableSet();

    final Clause expectedClause = mockController.getMock(Clause.class);

    final IndexedInputHelper indexedInputHelper = mockController.getMock(IndexedInputHelper.class);
    indexedInputHelper.getClauseForNavigatorValues(clauseName, expectedFilteredValues);
    mockController.setReturnValue(expectedClause);

    transformer =
        new VersionCustomFieldSearchInputTransformer(
            clauseName,
            new ClauseNames(clauseName),
            customField,
            indexInfoResolver,
            operandResolver,
            fieldFlagOperandRegistry,
            searchContextVisibilityChecker,
            versionResolver,
            customFieldInputHelper,
            versionManager) {
          @Override
          IndexedInputHelper getIndexedInputHelper() {
            return indexedInputHelper;
          }

          @Override
          boolean isVersionsNotRelatedToProjects(
              final Set<String> versionIdsFromHolder, final FieldValuesHolder fieldValuesHolder) {
            return false;
          }
        };

    mockController.replay();

    FieldValuesHolder holderValues =
        new FieldValuesHolderImpl(MapBuilder.singletonMap(urlParameterName, customFieldParams));
    assertEquals(
        expectedClause, transformer.getClauseFromParams(theUser, customFieldParams, holderValues));

    mockController.verify();
  }
  @Test
  public void testGetParamsFromSearchRequest() throws Exception {
    final String name = "clauseName";
    final User theUser = null;
    final CustomField field = mockController.getMock(CustomField.class);

    final QueryImpl query = new QueryImpl();

    final IndexedInputHelper indexInputHelper = mockController.getMock(IndexedInputHelper.class);
    indexInputHelper.getAllNavigatorValuesForMatchingClauses(
        theUser, new ClauseNames(name), query, searchContext);
    final Set<String> valuesAsStrings = Collections.singleton("Hi");
    mockController.setReturnValue(valuesAsStrings);

    final CustomFieldParams expectedParams = new CustomFieldParamsImpl(field, valuesAsStrings);

    final VersionCustomFieldSearchInputTransformer transformer =
        new VersionCustomFieldSearchInputTransformer(
            name,
            new ClauseNames(name),
            field,
            mockController.getMock(VersionIndexInfoResolver.class),
            mockController.getMock(JqlOperandResolver.class),
            mockController.getMock(FieldFlagOperandRegistry.class),
            searchContextVisibilityChecker,
            versionResolver,
            customFieldInputHelper,
            versionManager) {
          @Override
          IndexedInputHelper getIndexedInputHelper() {
            return indexInputHelper;
          }
        };

    mockController.replay();

    assertEquals(
        expectedParams, transformer.getParamsFromSearchRequest(null, query, searchContext));

    mockController.verify();
  }