From portal-commits at lists.jboss.org Fri Oct 19 06:42:51 2007 Content-Type: multipart/mixed; boundary="===============3107500700731743195==" MIME-Version: 1.0 From: portal-commits at lists.jboss.org To: portal-commits at lists.jboss.org Subject: [portal-commits] JBoss Portal SVN: r8714 - modules/test/trunk/docs/user-guide/en/modules. Date: Fri, 19 Oct 2007 06:42:51 -0400 Message-ID: --===============3107500700731743195== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: julien(a)jboss.com Date: 2007-10-19 06:42:51 -0400 (Fri, 19 Oct 2007) New Revision: 8714 Modified: modules/test/trunk/docs/user-guide/en/modules/pojotesting.xml Log: more documentation Modified: modules/test/trunk/docs/user-guide/en/modules/pojotesting.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- modules/test/trunk/docs/user-guide/en/modules/pojotesting.xml 2007-10-1= 9 09:53:23 UTC (rev 8713) +++ modules/test/trunk/docs/user-guide/en/modules/pojotesting.xml 2007-10-1= 9 10:42:51 UTC (rev 8714) @@ -96,7 +96,8 @@ = <methodname>assertNull</methodname> - + - Assert that the argument is null. + + Assert that the argument is null. + + = <methodname>assertNotNull</methodname> - + - Assert that the argument is not null. The method relies = on the generics and returns the same type - of the argument type in order to avoid a type cast, improving = the readability of the code. + + Assert that the argument is not null. The method relies on the generics and returns the same type + of the argument type in order to avoid a type cast, impr= oving the readability of the code. + + = - <methodname></methodname> - assertEquals + + - . + + Assert that the arguments are either null= or both are non null and the invocation of th= e first argument + equals method with the secon= d argument as parameter returns true. + + = - <methodname></methodname> - assertNotEquals + + - . + + Assert that either one argument is null and the other is not or that both arguments are non + null and the invocation of the fir= st argument equals method returns false. + + = - <methodname></methodname> - assertSame + + - . + + Assert that the arguments are either null= or are non null and have the same reference.<= /para> + + = - <methodname></methodname> - assertNotSame + + - . + + Assert that either one argument is null and the other is not or that both arguments + are non null but do not share the sam= e reference. + + = - <methodname></methodname> - assertInstanceOf + + - . + + Assert that an object implements or extends the sp= ecified class object. It leverages the generics to + have the same return type than the class argument which = allow to reuse the object with its asserted class + directly. + + + + = - - <methodname></methodname> + + Annotations + So far we have covered only the @Test annotation, in this chapter we will + review the other annotations available. + + + <interfacename>@Parameter</interfacename> + It is often interesting to run several times the same test = with different initial conditions. The + @Parameter annotation can be us= ed to provide an initial state to the tests. + It is possible to annotate Javabean property setters or test c= ase method arguments. When a property is annotated, + the parameter is scoped for all test cases contained in the PO= JO. Note that it is allowed to override + the name of the parameter using the name argument of the annotation. + + - . - + + A POJO with annotated Javabean property setters + + = - - <methodname></methodname> + When a test case method argument is annotated, only the tes= t case will have access to the parameter. In that + use case, the optional annotation parameter name becomes mandatory. + + + + A POJO with annotated Javabean property setters + + + + + + + <interfacename>@Test</interfacename> + The @Test annotation is used= to annotate a test case method that + is invoked at runtime by the JBoss Unit POJO extension. The metho= d must be public, non static, non abstract + and should have only arguments annotated with an @= Parameter annotation. + + By default the test name is the name of the + method but the annotation can be parameterized with a name argument that + will override the default name. + + + - . - + + A POJO with several test cases + + = + + + <interfacename>@Create</interfacename> and <interfacename>= @Destroy</interfacename> + The @Create and @Destroy annotations + are targetted for public, non static, methods that will be invoke= d to provide the POJO notifications + of the test life cycle. + The create method will be invoked prior any test case and w= ill have access to POJO scoped parameters. + It is allowed to fail by throwing any kind of throwable and will = make the test fail whenever it happens. If the + create method fails the test case method will not be invoked. + The destroy method is guaranteed to be always invoked wheth= er the test pass or fails. + + + + A POJO aware of its life cycle + + + + + + <interfacename>@Description</interfacename> + + + + + <interfacename>@Tag</interfacename> + + + + + + Integration with JBoss Microcontainer + + --===============3107500700731743195==--