|
|||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| AssertNullTagHandler.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 class will handle the processing of <assertnull> nodes.
|
|
| 13 |
* Insures that the actualobject specified is null.
|
|
| 14 |
*
|
|
| 15 |
* <H3>Summary</H3>
|
|
| 16 |
* <assertnull [message="message text"] actualrefid="id"|actualobject="value"/>
|
|
| 17 |
* <H3>One of the following attributes are required:</H3>
|
|
| 18 |
* actualrefid id of object to be checked.<br>
|
|
| 19 |
* actualobject Value to be check.
|
|
| 20 |
*
|
|
| 21 |
* <H3>Optional Attributes:</H3>
|
|
| 22 |
* message Optional message text to be specified.
|
|
| 23 |
*
|
|
| 24 |
* <H3>Depricated Attributes:</H3>
|
|
| 25 |
* The following attributes have been depricated:<br>
|
|
| 26 |
* refid replaced by actualrefid
|
|
| 27 |
*
|
|
| 28 |
* @author <a href="mailto:vraravam@thoughtworks.com">Vijay Aravamudhan : ThoughtWorks Inc.</a>
|
|
| 29 |
*/
|
|
| 30 |
public class AssertNullTagHandler extends AbstractAssertTagHandler { |
|
| 31 |
/**
|
|
| 32 |
* Constructor for AssertNotTagHandler.
|
|
| 33 |
*
|
|
| 34 |
* @param element The element to be processed
|
|
| 35 |
* @param testCase The IXMLTestCase that uses this element
|
|
| 36 |
*/
|
|
| 37 | 10 |
public AssertNullTagHandler(final Element element,
|
| 38 |
final IXMLTestCase testCase) {
|
|
| 39 | 10 |
super(element, testCase);
|
| 40 |
} |
|
| 41 |
|
|
| 42 |
/**
|
|
| 43 |
* Assert that the actual object specified is null.
|
|
| 44 |
* @throws XMLException is thrown upon assert.
|
|
| 45 |
*/
|
|
| 46 | 8 |
public void processElement() throws XMLException { |
| 47 | 8 |
validateElement(); |
| 48 | 7 |
Assert.assertNull( |
| 49 |
getMessage(), |
|
| 50 |
getActualObject()); |
|
| 51 |
} |
|
| 52 |
|
|
| 53 |
/**
|
|
| 54 |
* Insure that a actual attribute is present.
|
|
| 55 |
* @throws XMLException if the required attribute is
|
|
| 56 |
* missing.
|
|
| 57 |
*/
|
|
| 58 | 8 |
public void validateElement() throws XMLException { |
| 59 | 8 |
super.validateElement();
|
| 60 | 8 |
checkActual(); |
| 61 |
} |
|
| 62 |
} |
|
| 63 |
|
|
||||||||||