ActionCompleter implements Completer { @Override public int complete(String buffer, int cursor, List<String> candidates) { StringsCompleter delegate = new StringsCompleter(); delegate.getStrings().add(NicProvider.ACTION_ALLOW); delegate.getStrings().add(NicProvider.ACTION_BLOCK); delegate.getStrings().add(NicProvider.ACTION_LOG); delegate.getStrings().add(NicProvider.ACTION_REDIRECT); return delegate.complete(buffer, cursor, candidates); }  @Override int complete(String buffer, int cursor, List<String> candidates);  }
@Test public void testComplete() { final int success = 0; final int failure = -1; candidate = new ArrayList<String>(); candidateFailure = new ArrayList<String>(); candidate.add("candidateOne"); candidate.add("candidateTwo"); candidate.add(null); assertEquals(success, actionCompleter.complete(BUFFER, CURSOR, candidate)); assertEquals(success, actionCompleter.complete("", CURSOR, candidate)); assertEquals(success, actionCompleter.complete(null, CURSOR, candidate)); assertEquals(success, actionCompleter.complete(BUFFER, 0, candidate)); assertEquals("Empty Candidate List", failure, (actionCompleter.complete(BUFFER, CURSOR, candidateFailure))); }