The JUnit plug-in is meant for those tests that are interface-independent. It is also a plug-in in it's simplest form. Some examples of using the JUnit plug-in might include:
<ju-session/> | The JUnit plug-in provided session tag |
<ju-assert-equals/> | checks the equality of two values. |
<ju-assert-true/> | Checks that provided Expression is true. |
<ju-assert-not-null/> | Checks that the given value is not null. |
<ju-assert-null/> | Checks that the given value is null. |
This is the JUnit Session Tag. It has attributes outside from the Session Tag Common Attributes
This tag is used to compare two values:
Attribuate Name | Attribuate Description |
---|---|
expected | The expected value |
actual | The actual value |
msg | The message to be printed out if the test fails |
Some examples:
<ju-assert-equals functionId="Compare 1 against 1" expected="1" actual="1"/> <ju-assert-equals functionId="Compare one against two" expected="one" actual="two" msg="Numbers as Words"/>
This tag is used to do a boolean compare:
Attribuate Name | Attribuate Description |
---|---|
test | An expression with a boolean results. |
msg | The message to be printed out if the test fails |
Some examples:
<ju-assert-true functionId="Compare 1 against 1" test="${1 == 1}"/> <jelly:set var="counter" value="4"/> <ju-assert-true functionId="Compare a context variable with 4" test="${counter == 4}"/>
This tag is used to check that a provided value is not null.
Attribuate Name | Attribuate Description |
---|---|
value | The value to check for null |
msg | The message to be printed out if the test fails |
Example:
<ju-assert-not-null functionId="Check that a non-existent context variable is not null" value="${nonExistentVariable}" msg="value was null!"/>
This tag is used to check that a provided value is null.
Attribuate Name | Attribuate Description |
---|---|
value | The value to check for null |
msg | The message to be printed out if the test fails |
Example:
<ju-assert-null functionId="Check that a context variable is null" value="${someVariable}" msg="value was null!"/>