|
|||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| FailTagHandler.java | - | 100% | 100% | 100% |
|
||||||||||||||
| 1 |
package junit.extensions.xml.elements;
|
|
| 2 |
|
|
| 3 |
import junit.extensions.xml.IXMLTestCase;
|
|
| 4 |
import junit.extensions.xml.XMLException;
|
|
| 5 |
|
|
| 6 |
import junit.framework.Assert;
|
|
| 7 |
|
|
| 8 |
import org.w3c.dom.Element;
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
/**
|
|
| 12 |
* This tag handler forces the test case to fail by throwing a
|
|
| 13 |
* AssertFailError from the test case.
|
|
| 14 |
* <H3>Summary</H3>
|
|
| 15 |
* fail [message="message text"]
|
|
| 16 |
* <H3>Attributes</H3>
|
|
| 17 |
* message - message is a optional attribute which may be specified.
|
|
| 18 |
* The message text is reported in the assertion error thrown.<p><p>
|
|
| 19 |
* @author Kevin Wilson
|
|
| 20 |
*/
|
|
| 21 |
public class FailTagHandler extends AbstractAssertTagHandler { |
|
| 22 |
/**
|
|
| 23 |
* Constructor for AssertNotNullTagHandler.
|
|
| 24 |
*
|
|
| 25 |
* @param element The element to be processed.
|
|
| 26 |
* @param testCase The IXMLTestCase that uses this element.
|
|
| 27 |
*/
|
|
| 28 | 2 |
public FailTagHandler(final Element element, final IXMLTestCase testCase) {
|
| 29 | 2 |
super(element, testCase);
|
| 30 |
} |
|
| 31 |
|
|
| 32 |
/**
|
|
| 33 |
* @see junit.extensions.xml.elements.AbstractTagHandler#processElement().
|
|
| 34 |
* @throws XMLException This method allways throws a AssertionFailError(message).
|
|
| 35 |
*/
|
|
| 36 | 1 |
public void processElement() throws XMLException { |
| 37 | 1 |
validateElement(); |
| 38 | 1 |
Assert.fail(getMessage()); |
| 39 |
} |
|
| 40 |
} |
|
| 41 |
|
|
||||||||||