1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.apache.commons.jelly.tags.junit;
17
18 import org.apache.commons.jelly.JellyTagException;
19 import org.apache.commons.jelly.XMLOutput;
20
21 /***
22 * This tag causes a failure message. The message can either
23 * be specified in the tags body or via the message attribute.
24 *
25 * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
26 * @version $Revision: 155420 $
27 */
28 public class FailTag extends AssertTagSupport {
29
30 private String message;
31
32 public FailTag() {
33 }
34
35
36
37 public void doTag(XMLOutput output) throws JellyTagException {
38 String message = getMessage();
39 if ( message == null ) {
40 message = getBodyText();
41 }
42 fail( message );
43 }
44
45
46
47
48 /***
49 * @return the failure message
50 */
51 public String getMessage() {
52 return message;
53 }
54
55
56 /***
57 * Sets the failure message. If this attribute is not specified then the
58 * body of this tag will be used instead.
59 */
60 public void setMessage(String message) {
61 this.message = message;
62 }
63 }