SynonymRecordSearcher { public void addSearcher(SynonymIndexSearcher searcher, int columnIndex) { assert columnIndex < this.recordSize; if (searcher == null) { LOG.error("SynonymRecordSearcher.tried" + columnIndex); } searchers[columnIndex] = searcher; } SynonymRecordSearcher(int size); List<OutputRecord> search(int maxNbOutputResults, String[] record); void addSearcher(SynonymIndexSearcher searcher, int columnIndex); SynonymIndexSearcher getSearcher(int columnIndex);  }
@Test public void testAddSearcher() { SynonymRecordSearcher recSearcher = new SynonymRecordSearcher(2); try { recSearcher.addSearcher(null, 0); } catch (Exception e) { assertNotNull("we should get an exception here", e); } try { recSearcher.addSearcher(new SynonymIndexSearcher(), 2); fail("Index should be out of bounds here: trying to set a searcher at position in an empty array"); } catch (Exception e) { assertNotNull("we should get an exception here", e); } catch (AssertionError e) { assertNotNull("we should get an assertion error here when -ea is added to the VM arguments", e); } try { SynonymIndexSearcher searcher = new SynonymIndexSearcher(); recSearcher.addSearcher(searcher, 1); } catch (Exception e) { fail(e.getMessage()); } try { SynonymIndexSearcher searcher = new SynonymIndexSearcher(); recSearcher.addSearcher(searcher, -1); } catch (Exception e) { assertNotNull("we should get an exception here", e); } }