List Info

Thread: enabling java assertions in the tests




enabling java assertions in the tests
country flaguser name
United States
2007-05-31 17:30:23
While testing LUCENE-866 I realized that Java assertions
are disabled when *I* run 'ant test'.

Others did have the assertion executed and causing that
NPE. So I am not sure if this is general problem or only
a Windows one.

Compile wise we are ok, having "-source 1.4".
At runtime, assertions can be enabled by running "java
-ea".
Using ant, setting "ANT_ARGS=-ea" is supposed to
have the
same effect, but it doesn't, at least not for me.

Adding:
     <assertions>
         <enable/>
     </assertions>
to the <junit> task would enable assertions during
tests
regardless of ANT_OPTS variable (and hopefully on all OSs).

Anyone sees a problem with adding this?

Btw, I think we can/should use Java asserts more (there are
currently only 4 active asserts under trunk/java).

Doron


------------------------------------------------------------
---------
To unsubscribe, e-mail: java-dev-unsubscribelucene.apache.org
For additional commands, e-mail: java-dev-helplucene.apache.org


Re: enabling java assertions in the tests
country flaguser name
Netherlands
2007-05-31 18:21:09
On Friday 01 June 2007 00:30, Doron Cohen wrote:
> 
> While testing LUCENE-866 I realized that Java
assertions
> are disabled when *I* run 'ant test'.
> Others did have the assertion executed and causing
that
> NPE. So I am not sure if this is general problem or
only
> a Windows one.

Indeed, see below. I'm running Linux and java 1.6.0.
 
> Compile wise we are ok, having "-source
1.4".
> At runtime, assertions can be enabled by running
"java -ea".
> Using ant, setting "ANT_ARGS=-ea" is supposed
to have the
> same effect, but it doesn't, at least not for me.
> 
> Adding:
>      <assertions>
>          <enable/>
>      </assertions>
>
> to the <junit> task would enable assertions
during tests
> regardless of ANT_OPTS variable (and hopefully on all
OSs).
> 
> Anyone sees a problem with adding this?

My common-build.xml has this added in the junit task:

      <assertions>
        <enable
package="org.apache.lucene"/>
      </assertions>

Regards,
Paul Elschot

------------------------------------------------------------
---------
To unsubscribe, e-mail: java-dev-unsubscribelucene.apache.org
For additional commands, e-mail: java-dev-helplucene.apache.org


[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )