Package org.gradle.gradleplugin.foundation.search

Examples of org.gradle.gradleplugin.foundation.search.BasicTextSearchCriteria


    /**
     * This does a basic search. Something simple expecting matches
     */
    public void testBasic() {
        TextBlockSearchEditor editor = new TextBlockSearchEditor();
        BasicTextSearchCriteria criteria = new BasicTextSearchCriteria();
        criteria.setTextToMatch("error");
        criteria.setCaseSensitive(false);

        int matches = editor.searchAllText(TEXT_1, criteria);

        assertEquals("Failed to find the correct number of matches", 2, matches);   //this tests the matches return result is correct

View Full Code Here


    /**
     * This searches with case sensitivity on.
     */
    public void testCaseSensitivity() {
        TextBlockSearchEditor editor = new TextBlockSearchEditor();
        BasicTextSearchCriteria criteria = new BasicTextSearchCriteria();
        criteria.setTextToMatch("ErRor");
        criteria.setCaseSensitive(true);

        int matches = editor.searchAllText(TEXT_1, criteria);

        assertEquals("Failed to find the correct number of matches", 1, matches);   //this tests the matches return result is correct

View Full Code Here

     */
    public void testIndices() {
        String textToSearch = "01234567890123456789";

        TextBlockSearchEditor editor = new TextBlockSearchEditor();
        BasicTextSearchCriteria criteria = new BasicTextSearchCriteria();
        criteria.setTextToMatch("2");
        criteria.setCaseSensitive(false);

        int matches = editor.searchAllText(textToSearch, criteria);

        assertEquals("Failed to find the correct number of matches", 2, matches);   //this tests the matches return result is correct

View Full Code Here

     */
    public void testWithNoCriteria() {
        String textToSearch = "01234567890123456789";

        TextBlockSearchEditor editor = new TextBlockSearchEditor();
        BasicTextSearchCriteria criteria = new BasicTextSearchCriteria();
        criteria.setTextToMatch(null);
        criteria.setCaseSensitive(false);

        int matches = editor.searchAllText(textToSearch, criteria);

        assertEquals("Failed to find the correct number of matches", 0, matches);   //this tests the matches return result is correct

View Full Code Here

    /**
     * Tests with 'null' for the text to search. This is just to make sure nothing blows up.
     */
    public void testWithSearchText() {
        TextBlockSearchEditor editor = new TextBlockSearchEditor();
        BasicTextSearchCriteria criteria = new BasicTextSearchCriteria();
        criteria.setTextToMatch("a");
        criteria.setCaseSensitive(false);

        int matches = editor.searchAllText(null, criteria);

        assertEquals("Failed to find the correct number of matches", 0, matches);   //this tests the matches return result is correct

View Full Code Here

     */
    public void testSecondSearchBlank() {
        String textToSearch = "01234567890123456789";

        TextBlockSearchEditor editor = new TextBlockSearchEditor();
        BasicTextSearchCriteria criteria = new BasicTextSearchCriteria();
        criteria.setTextToMatch("2");
        criteria.setCaseSensitive(false);

        int matches = editor.searchAllText(textToSearch, criteria);

        assertEquals("Failed to find the correct number of matches", 2, matches);   //this tests the matches return result is correct

        TestUtility.assertListContents(editor.getMatchedResults(), new TextBlockSearchEditor.SearchResult("2", 2, 3),
                new TextBlockSearchEditor.SearchResult("2", 12, 13));

        criteria.setTextToMatch("");
        criteria.setCaseSensitive(false);

        matches = editor.searchAllText(textToSearch, criteria);

        assertEquals("Failed to find the correct number of matches", 0, matches);   //this tests the matches return result is correct

View Full Code Here

    /**
     * This does a simple test of searching via a regular expression. This one is case insensitive.
     */
    public void testBasicRegularExpressions() {
        TextBlockSearchEditor editor = new TextBlockSearchEditor();
        BasicTextSearchCriteria criteria = new BasicTextSearchCriteria();
        criteria.setTextToMatch("error [1-9]:");
        criteria.setCaseSensitive(false);
        criteria.setUseRegularExpressions(true);

        int matches = editor.searchAllText(TEXT_1, criteria);

        assertEquals("Failed to find the correct number of matches", 2, matches);   //this tests the matches return result is correct

View Full Code Here

    /**
     * This does a simple test of searching via a regular expression but is case sensitive.
     */
    public void testCaseSensitiveRegularExpressions() {
        TextBlockSearchEditor editor = new TextBlockSearchEditor();
        BasicTextSearchCriteria criteria = new BasicTextSearchCriteria();
        criteria.setTextToMatch("error [1-9]:");
        criteria.setCaseSensitive(true);
        criteria.setUseRegularExpressions(true);

        int matches = editor.searchAllText(TEXT_1, criteria);

        assertEquals("Failed to find the correct number of matches", 1, matches);   //this tests the matches return result is correct

View Full Code Here

TOP

Related Classes of org.gradle.gradleplugin.foundation.search.BasicTextSearchCriteria

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.