org.newsml.toolkit.conformance
Class PatternTest

java.lang.Object
  |
  +--org.newsml.toolkit.conformance.TestBase
        |
        +--org.newsml.toolkit.conformance.PatternTest

public class PatternTest
extends TestBase

Test Text content against a regular expression.

This class tests the content of any Text node against a regular expression, and reports an error if the test fails.

Version:
2.0
Author:
Reuters PLC
See Also:
NewsMLTestManager

Constructor Summary
PatternTest(String pattern)
          Construct a new test using the regular expression provided.
PatternTest(String pattern, String description)
          Construct a new test using the regular exp.
 
Method Summary
 void run(BaseNode node, boolean useExternal)
          Test a pattern against a Text node.
 
Methods inherited from class org.newsml.toolkit.conformance.TestBase
error, internal, warning
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PatternTest

public PatternTest(String pattern)
Construct a new test using the regular expression provided.

The regular expression will also serve as the error description; that can be a little cryptic.

Parameters:
pattern - A regular expression.

PatternTest

public PatternTest(String pattern,
                   String description)
Construct a new test using the regular exp. and description provided.
Parameters:
pattern - A regular expression.
description - A human readable description of the regular expression's purpose.
Method Detail

run

public void run(BaseNode node,
                boolean useExternal)
         throws NewsMLException
Test a pattern against a Text node.
Overrides:
run in class TestBase
Parameters:
node - A Text node.
useExternal - Not used.
Throws:
NewsMLException - If the test fails.
java.lang.ClassCastException - If the node parameter is not an instance of Text.
See Also:
TestBase.run(org.newsml.toolkit.BaseNode, boolean)