@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(); }
@Test public void testGetParamsFromSearchRequestNullSearchRequest() throws Exception { VersionCustomFieldSearchInputTransformer transformer = createTransformer("cf[1000]"); assertNull(transformer.getParamsFromSearchRequest(null, null, searchContext)); mockController.verify(); }