1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package net.sf.jameleon.plugin.junit.tags;
20
21 import org.apache.commons.jelly.expression.Expression;
22
23 /***
24 * Performs an assertTrue on a given expression. This tag, along with all JUnit tags
25 * can be used inside any other plug-in's session tag
26 *
27 * The following is an example:
28 * <pre><source>
29 * <testcase xmlns="jelly:jameleon" xmlns:j="jelly:core">
30 * <j:set var="greeting" value="Hello World!"/>
31 * <ju-session>
32 * <ju-assert-true
33 * functionId="check that 'greeting' has at least one character in it"
34 * test="${greeting.length() >= 1"/>
35 * </ju-session>
36 * </testcase>
37 * </source></pre>
38 * @jameleon.function name="ju-assert-true" type="action"
39 * @jameleon.step Verify that the expected expression validates to true.
40 */
41 public class AssertTrueTag extends AbstractAssertTag{
42
43 /***
44 * The test to be executed
45 * @jameleon.attribute required="true"
46 */
47 protected Expression test;
48
49 public void testBlock(){
50 if (msg != null) {
51 assertTrue(msg, test.evaluateAsBoolean(context));
52 }else{
53 assertTrue(test.evaluateAsBoolean(context));
54 }
55 }
56
57 }