View Javadoc

1   /*
2       Jameleon - An automation testing tool..
3       Copyright (C) 2003-2006 Christian W. Hargraves (engrean@hotmail.com)
4       
5       This library is free software; you can redistribute it and/or
6       modify it under the terms of the GNU Lesser General Public
7       License as published by the Free Software Foundation; either
8       version 2.1 of the License, or (at your option) any later version.
9   
10      This library is distributed in the hope that it will be useful,
11      but WITHOUT ANY WARRANTY; without even the implied warranty of
12      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13      Lesser General Public License for more details.
14  
15      You should have received a copy of the GNU Lesser General Public
16      License along with this library; if not, write to the Free Software
17      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  */
19  package net.sf.jameleon.plugin.junit.tags;
20  
21  /***
22   * Performs an assertNull on a given variable. This tag, along with all JUnit tags
23   * can be used inside any other plug-in's session tag
24   * 
25   * An example use might be:
26   * 
27   * <pre><source>
28   * &lt;testcase xmlns="jelly:jameleon"&gt;
29   *     &lt;ju-session application="someApp"&gt;
30   *       &lt;ju-assert-null
31   *           functionId="Check that var1 equals var2."
32   *           value="${someNonExistentVar}"/&gt;
33   *     &lt;/ju-session&gt;
34   * &lt;/testcase&gt;
35   * </source></pre>
36   *
37   * @jameleon.function name="ju-assert-null" type="action"
38   * @jameleon.step Validate the provided variable is null
39   */
40  public class AssertNullTag extends AbstractAssertTag{
41  
42      /***
43       * The value to be checked for null
44       * @jameleon.attribute
45       */
46      protected Object value;
47  
48      public void testBlock(){
49          if (msg != null) {
50              assertNull(msg, value);
51          }else{
52              assertNull(value);
53          }
54      }
55  
56  }