Package org.htmlparser.visitors

Examples of org.htmlparser.visitors.StringFindingVisitor


    assertTrue("text should be found", visitor.stringWasFound());
  }

  public void testStringFoundCount() throws Exception {
    createParser(HTML);
    StringFindingVisitor visitor = new StringFindingVisitor("is");
    parser.visitAllNodesWith(visitor);
    assertEquals("# times 'is' was found", 2, visitor.stringFoundCount());

    visitor = new StringFindingVisitor("and");
    parser.visitAllNodesWith(visitor);
    assertEquals("# times 'and' was found", 0, visitor.stringFoundCount());
  }
View Full Code Here


    assertEquals("# times 'and' was found", 0, visitor.stringFoundCount());
  }

  public void testStringFoundMultipleTimes() throws Exception {
    createParser(HTML_TO_SEARCH);
    StringFindingVisitor visitor = new StringFindingVisitor("TEST");
    visitor.doMultipleSearchesWithinStrings();
    parser.visitAllNodesWith(visitor);
    assertEquals("TEST found", 5, visitor.stringFoundCount());
  }
View Full Code Here

        super(name);
    }

    public void testSimpleStringFind() throws Exception {
        createParser(HTML);
        StringFindingVisitor visitor = new StringFindingVisitor("Hello");
        parser.visitAllNodesWith(visitor);
        assertTrue("Hello found", visitor.stringWasFound());
    }
View Full Code Here

        assertTrue("Hello found", visitor.stringWasFound());
    }

    public void testStringNotFound() throws Exception {
        createParser(HTML);
        StringFindingVisitor visitor = new StringFindingVisitor("industrial logic");
        parser.visitAllNodesWith(visitor);
        assertTrue("industrial logic should not have been found", !visitor.stringWasFound());
    }
View Full Code Here

        assertTrue("industrial logic should not have been found", !visitor.stringWasFound());
    }

    public void testStringInTagNotFound() throws Exception {
        createParser(HTML);
        StringFindingVisitor visitor = new StringFindingVisitor("HTML");
        parser.visitAllNodesWith(visitor);
        assertTrue("HTML should not have been found", !visitor.stringWasFound());
    }
View Full Code Here

        assertTrue("HTML should not have been found", !visitor.stringWasFound());
    }

    public void testStringFoundInSingleStringNode() throws Exception {
        createParser("this is some text!");
        StringFindingVisitor visitor = new StringFindingVisitor("text");
        parser.visitAllNodesWith(visitor);
        assertTrue("text should be found", visitor.stringWasFound());
    }
View Full Code Here

        assertTrue("text should be found", visitor.stringWasFound());
    }

    public void testStringFoundCount() throws Exception {
        createParser(HTML);
        StringFindingVisitor visitor = new StringFindingVisitor("is");
        parser.visitAllNodesWith(visitor);
        assertEquals("# times 'is' was found", 2, visitor.stringFoundCount());

        visitor = new StringFindingVisitor("and");
        parser.visitAllNodesWith(visitor);
        assertEquals("# times 'and' was found", 0, visitor.stringFoundCount());
    }
View Full Code Here

        assertEquals("# times 'and' was found", 0, visitor.stringFoundCount());
    }

    public void testStringFoundMultipleTimes() throws Exception {
        createParser(HTML_TO_SEARCH);
        StringFindingVisitor visitor = new StringFindingVisitor("TEST");
        visitor.doMultipleSearchesWithinStrings();
        parser.visitAllNodesWith(visitor);
        assertEquals("TEST found", 5, visitor.stringFoundCount());
    }
View Full Code Here

TOP

Related Classes of org.htmlparser.visitors.StringFindingVisitor

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.