Re: Assertions in junit tests [was: Re: Solving FindBugs issue]

2011-02-22 Thread Glenn Adams
I support enabling assertions by default on junit tests. More testing is a
good thing.

G.

On Tue, Feb 22, 2011 at 3:40 PM, Andreas Delmelle <
andreas.delme...@telenet.be> wrote:

> On 22 Feb 2011, at 19:25, Andreas Delmelle wrote:
>
> > One way to enable assertions I found so far, and that seems to work:
> > - use fork="true" on the  target
> > - insert:  in that target
> >
> > That seems to yield the expected behavior at first glance. Our junit
> targets are not forked, however. Not sure if that is preferable...
>
> FWIW, having configured this on the junit-layout-standard target, yields
> one AssertionError
>
> [junit] Testcase:
> block-container_reference-orientation_bug36391.xml(org.apache.fop.layoutengine.LayoutEngineTestSuite$1):
>Caused an ERROR
> [junit] null
> [junit] java.lang.AssertionError
> [junit] at
> org.apache.fop.layoutmgr.BreakingAlgorithm.getLineWidth(BreakingAlgorithm.java:1394)
>
> ...
>
>
> For the remainder, all layout tests pass.
>
>
> Regards,
>
> Andreas
> ---
>
>


Re: Assertions in junit tests [was: Re: Solving FindBugs issue]

2011-02-22 Thread Andreas Delmelle
On 22 Feb 2011, at 19:25, Andreas Delmelle wrote:

> One way to enable assertions I found so far, and that seems to work:
> - use fork="true" on the  target
> - insert:  in that target
> 
> That seems to yield the expected behavior at first glance. Our junit targets 
> are not forked, however. Not sure if that is preferable...

FWIW, having configured this on the junit-layout-standard target, yields one 
AssertionError

[junit] Testcase: 
block-container_reference-orientation_bug36391.xml(org.apache.fop.layoutengine.LayoutEngineTestSuite$1):
Caused an ERROR
[junit] null
[junit] java.lang.AssertionError
[junit] at 
org.apache.fop.layoutmgr.BreakingAlgorithm.getLineWidth(BreakingAlgorithm.java:1394)

...


For the remainder, all layout tests pass.


Regards,

Andreas
---



Re: Assertions in junit tests [was: Re: Solving FindBugs issue]

2011-02-22 Thread Andreas Delmelle

On 22 Feb 2011, at 19:04, Andreas Delmelle wrote:

> On 22 Feb 2011, at 08:50, Simon Pepping wrote:
>> It would be nice if assertions were checked during the junit tests.
>> However, when I set: , I get
>> junit.framework.AssertionFailedError errors. How can this be done?
> 
> Sounds like a good idea.
> IIC, simply using "-ea" would enable internal assertions for JUnit's classes 
> as well. 
> You probably want something like "-ea:org.apache.fop..." to make sure only 
> assertions in FOP's code are taken into account.

Tried that and failed.. :(

One way to enable assertions I found so far, and that seems to work:
- use fork="true" on the  target
- insert:  in that target

That seems to yield the expected behavior at first glance. Our junit targets 
are not forked, however. Not sure if that is preferable...


Regards,

Andreas
---



Re: Assertions in junit tests [was: Re: Solving FindBugs issue]

2011-02-22 Thread Andreas Delmelle
On 22 Feb 2011, at 08:50, Simon Pepping wrote:

> On Mon, Feb 21, 2011 at 08:28:33PM +0100, Andreas Delmelle wrote:
>> I saw one exclusion --unconfirmed cast-- that would seem to stem from my 
>> recent refactoring in the BlockStackingLMs. Not sure why an exclusion was 
>> chosen here, but adding an assert statement in the code avoids the warning 
>> as well *and* has the benefit of being visible exactly at the spot in the 
>> code where it applies. Seemed like the more proper way to handle this.
> 
> It would be nice if assertions were checked during the junit tests.
> However, when I set: , I get
> junit.framework.AssertionFailedError errors. How can this be done?

Sounds like a good idea.
IIC, simply using "-ea" would enable internal assertions for JUnit's classes as 
well. 
You probably want something like "-ea:org.apache.fop..." to make sure only 
assertions in FOP's code are taken into account.


Regards,

Andreas
---



Re: Assertions in junit tests [was: Re: Solving FindBugs issue]

2011-02-21 Thread Simon Pepping
On Mon, Feb 21, 2011 at 08:28:33PM +0100, Andreas Delmelle wrote:
> I saw one exclusion --unconfirmed cast-- that would seem to stem from my 
> recent refactoring in the BlockStackingLMs. Not sure why an exclusion was 
> chosen here, but adding an assert statement in the code avoids the warning as 
> well *and* has the benefit of being visible exactly at the spot in the code 
> where it applies. Seemed like the more proper way to handle this.

It would be nice if assertions were checked during the junit tests.
However, when I set: , I get
junit.framework.AssertionFailedError errors. How can this be done?

Simon