ReferenceSuggestionServiceImpl extends AbstractIgnoreMergedListSuggestionServiceImpl<BookName> { String prepInput(String input) { final int inputLength = input.length(); if (inputLength > 0) { final char lastChar = input.charAt(inputLength - 1); if (lastChar == '-') { return input.substring(0, inputLength - 1) + "ff"; } if (inputLength > 1) { final char secondLastChar = input.charAt((inputLength - 2)); if (inputLength > 1 && lastChar == 'f') { if(Character.isDigit(secondLastChar)) { return input.substring(0, inputLength - 1) + "ff"; } else if(secondLastChar == '-') return input.substring(0, inputLength - 2) + "ff"; } } } return input; } @Inject  ReferenceSuggestionServiceImpl(final JSwordVersificationService versificationService,
                                          final InternationalRangeService internationalRangeService); @Override BookName[] getExactTerms(final SuggestionContext context, final int max, final boolean popularSort); @Override BookName[] collectNonExactMatches(final TermsAndMaxCount<BookName> collector,
                                             final SuggestionContext context, final BookName[] alreadyRetrieved,
                                             final int leftToCollect);  }
@Test public void testPrepInput() throws Exception { assertEquals("", service.prepInput("")); assertEquals("a", service.prepInput("a")); assertEquals("Gen", service.prepInput("Gen")); assertEquals("Gen.1", service.prepInput("Gen.1")); assertEquals("Gen.1:1", service.prepInput("Gen.1:1")); assertEquals("Gen 1-2", service.prepInput("Gen 1-2")); assertEquals("Laf 1:1", service.prepInput("Laf 1:1")); assertEquals("Gen 1:1ff", service.prepInput("Gen 1:1-")); assertEquals("Gen 1:1ff", service.prepInput("Gen 1:1f")); assertEquals("Gen 1:1ff", service.prepInput("Gen 1:1-f")); }