What3WordsSearchChannel extends SearchChannel { public boolean isValidSearchTerm(SearchCriteria criteria) { if(criteria.isReverseGeocode()) { return true; } String[] parts = criteria.getSearchString().split("\\."); return parts.length == 3; }  @Override void init(); boolean isValidSearchTerm(SearchCriteria criteria); Capabilities getCapabilities(); ChannelSearchResult doSearch(SearchCriteria searchCriteria); Point getServiceCoordinates(double lon, double lat, String srs); ChannelSearchResult reverseGeocode(SearchCriteria sc); SearchResultItem parseResult(JSONObject dataItem, String targetSrs); int getRank(String type); static final String ID; static final String SERVICE_SRS; }
@Test public void testIsValidSearchTerm() throws Exception { SearchChannel channel = new What3WordsSearchChannel(); SearchCriteria sc = new SearchCriteria(); sc.setSearchString("asdf"); assertFalse("Invalid search term: " + sc.getSearchString(), channel.isValidSearchTerm(sc)); sc.setSearchString("carting.pint.invent"); assertTrue("Valid search term: " + sc.getSearchString(), channel.isValidSearchTerm(sc)); }