lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From DM Smith <dmsmith...@gmail.com>
Subject Re: enabling java assertions in the tests
Date Thu, 31 May 2007 22:59:05 GMT
I think that having assertions is of no value if they are never  
turned on :)

I suggest going carefully in adding assertions. There are a lot of  
places where assertions are inappropriate (e.g. checking parameters  
on a public method).

I think Sun's document gives good guidelines:

http://java.sun.com/j2se/1.4.2/docs/guide/lang/assert.html

-- DM Smith

On May 31, 2007, at 6:30 PM, 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.
>
> 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-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-dev-help@lucene.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


Mime
View raw message