Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AbstractCompletionProvider.getCompletionByInputText() result not durable #34

Open
tttwang23 opened this issue Nov 14, 2016 · 1 comment

Comments

@tttwang23
Copy link

Test case below. The test fails at the second set of checks.

/*
 * 12/14/2016
 *
 * TestDefaultCompletionProvider.java - test basic completion provider implementation.
 * 
 * This library is distributed under a modified BSD license.  See the included
 * AutoComplete.License.txt file for details.
 */


package org.fife.ui.autocomplete;

import java.util.List;

import org.junit.Assert;
import org.junit.runners.MethodSorters;

import org.junit.FixMethodOrder;
import org.junit.Test;



/**
 * Test cases for DefaultCompletionProvider
 *
 * @author Thomas Wang
 */
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestDefaultCompletionProvider extends DefaultCompletionProvider
{

    @Test
    public void testGetCompletionByInputText()
    {
        DefaultCompletionProvider provider = new DefaultCompletionProvider();
        final Completion c1 = new BasicCompletion(provider, "BETA");
        final Completion c2 = new BasicCompletion(provider, "beta");
        final Completion c3 = new BasicCompletion(provider, "ALPHA");
        final Completion c4 = new BasicCompletion(provider, "alpha");
        final Completion c5 = new BasicCompletion(provider, "GAMMA");
        final Completion c6 = new BasicCompletion(provider, "gamma");
        provider.addCompletion(c1);
        provider.addCompletion(c2);
        List<Completion> betaList = provider.getCompletionByInputText("beta");
        // Check for correct properties of returned list.
        Assert.assertTrue(betaList.size() == 2);
        for (Completion comp : betaList)
        {
            Assert.assertTrue("beta".equalsIgnoreCase(comp.getInputText()));
        }
        provider.addCompletion(c3);
        provider.addCompletion(c4);
        provider.addCompletion(c5);
        provider.addCompletion(c6);
        // Check for correct properties of returned list.
        Assert.assertTrue(betaList.size() == 2);
        for (Completion comp : betaList)
        {
            Assert.assertTrue("beta".equalsIgnoreCase(comp.getInputText()));
        }
    }

}
@tttwang23
Copy link
Author

I have fixed this issue. Working on pull request today.

tttwang23 added a commit to tttwang23/AutoComplete that referenced this issue Nov 15, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant