use of org.alfresco.rest.api.search.model.Spelling in project alfresco-remote-api by Alfresco.
the class SearchMapperTests method fromSpelling.
@Test
public void fromSpelling() throws Exception {
SearchParameters searchParameters = new SearchParameters();
// Doesn't error
searchMapper.fromSpellCheck(searchParameters, null);
assertFalse(searchParameters.isSpellCheck());
try {
searchMapper.fromSpellCheck(searchParameters, new Spelling(null));
fail();
} catch (InvalidArgumentException iae) {
// Can't be null
assertNotNull(iae);
}
// Now set search term first
searchParameters.setSearchTerm("fred");
searchMapper.fromSpellCheck(searchParameters, new Spelling(null));
assertEquals("fred", searchParameters.getSearchTerm());
// Now query replaces userQuery (search term)
searchMapper.fromSpellCheck(searchParameters, new Spelling("favourit"));
assertEquals("favourit", searchParameters.getSearchTerm());
assertTrue(searchParameters.isSpellCheck());
}
Aggregations