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 assertNotNull 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" xmlns:j="jelly:core"&gt;
29   *     &lt;j:set-var var="someVar" value="some value"/&gt;
30   *     &lt;ju-session application="someApp"&gt;
31   *       &lt;ju-assert-not-null
32   *           functionId="Check that var1 equals var2."
33   *           value="${someVar}"/&gt;
34   *     &lt;/ju-session&gt;
35   * &lt;/testcase&gt;
36   * </source></pre>
37   *
38   * @jameleon.function name="ju-assert-not-null" type="action"
39   * @jameleon.step Validate the provided variable is not null
40   */
41  public class AssertNotNullTag extends AbstractAssertTag{
42  
43      /***
44       * The value to be checked for null
45       * @jameleon.attribute
46       */
47      protected Object value;
48  
49      public void testBlock(){
50          if (msg != null) {
51              assertNotNull(msg, value);
52          }else{
53              assertNotNull(value);
54          }
55      }
56  
57  }