You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@Test
public void testCompletionRemoval()
{
final DefaultCompletionProvider provider1 =
new DefaultCompletionProvider();
final ArrayList<Completion> box1 = new ArrayList<Completion>();
final Completion c1 = new BasicCompletion(provider1, "BAAA");
final Completion c2 = new BasicCompletion(provider1, "beta");
final Completion c3 = new ShorthandCompletion(provider1, "BETA", "BETA");
box1.add(c1);
box1.add(c2);
box1.add(c3);
provider1.addCompletions(box1);
final DefaultCompletionProvider provider2 =
new DefaultCompletionProvider();
final ArrayList<Completion> box2 = new ArrayList<Completion>();
final Completion c4 = new ShorthandCompletion(provider2, "alpha", "alpha");
final Completion c5 = new BasicCompletion(provider2, "ALPHA");
final Completion c6 = new BasicCompletion(provider2, "ZZZZZ");
box2.add(c4);
box2.add(c5);
box2.add(c6);
provider2.addCompletions(box2);
// Check we can remove the "BETA" completion.
Assert.assertTrue(provider1.removeCompletion(c3));
// Check that the "beta" completion should remain.
List<Completion> betaList = provider1.getCompletionByInputText("beta");
Assert.assertEquals(1, betaList.size());
for (Completion comp : betaList)
{
Assert.assertEquals("beta", comp.getInputText());
}
// Check we can remove the "ALPHA" completion.
Assert.assertTrue(provider2.removeCompletion(c5));
// Check that the "alpha" completion should remain.
List<Completion> alphaList = provider2.getCompletionByInputText("alpha");
Assert.assertEquals(1, alphaList.size());
for (Completion comp : alphaList)
{
Assert.assertEquals("alpha", comp.getInputText());
}
}
The text was updated successfully, but these errors were encountered:
tttwang23
added a commit
to tttwang23/AutoComplete
that referenced
this issue
Nov 15, 2016
Test case:
The text was updated successfully, but these errors were encountered: