Feature Requests item #1047329, was opened at 2004-10-14 15:59
Message generated for change (Comment added) made by cristamd
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=497985&aid=1047329&group_id=61302

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Nobody/Anonymous (nobody)
Summary: assertRegexPresent and assertRegexNotPresent would be great

Initial Comment:
This two methods would allow me to stop using my own
versions. Presumably jwebunit can require Java 1.4 to
make this easy to do.

----------------------------------------------------------------------

Comment By: Matthew D. Cristantello (cristamd)
Date: 2005-08-30 13:38

Message:
Logged In: YES 
user_id=839422

Here's some basic code to do this using the Java regex stuff:
protected void assertRegexPresent(String regex)
        {
                Pattern matchPattern = Pattern.compile(regex);
                Matcher matcher =
matchPattern.matcher(getDialog().getResponseText());
                assertTrue("Expected regualar expression not found in
response: ["+regex+"]",matcher.find());
        }

I'd argue against asking the whole response to match the
regex, as I had a lot of trouble trying to deal with the
tags and linebreaks in the HTML code (.* does not match the
response, for some reason).

Hope this helps,
~Matt

----------------------------------------------------------------------

Comment By: Björn Beskow (bbeskow)
Date: 2004-10-19 01:37

Message:
Logged In: YES 
user_id=444639

I definitely agree!

Perhaps an even better naming would be

assertMatch(String regex)
assertNoMatch(String regex)

assertMatchInElement(String elementID, String regex)
assertNoMatchInElement(String elementID, String regex)

assertMatchInTable(String tableSummaryOrId, String regex)
assertNoMatchInTable(String tableSummaryOrId, String regex)

assertMatchInTable(String tableSummaryOrId, String[] regex)
assertNoMatchInTable(String tableSummaryOrId, String[] 
regex)


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=497985&aid=1047329&group_id=61302


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Jwebunit-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jwebunit-development

Reply via email to