Re: [pcgen_developers] Re: Use of Assert
Yes that would work, but you'd need to add that to the run config each
time you ran the tests though. That does really adhere to the "principle
of least surprise". I think what was intended was assertTrue, but when
looking at that it was breaking negative tests (testing of invalid
conditions) anyway so I just commented those occurrences out.
On 8/01/2010 12:19 PM lescoutinhovr wrote
> Would not work if you add the -ea argument to the VM in Eclipse?
> --- In firstname.lastname@example.org, James Dempsey <jdempsey@...> wrote:
>> I am currently debugging some unit tests which are failing under maven 2
>> (in the CI build) but not when run in Eclipse or ant.
>> It turns out that the Java assert command used in the unit test is not
>> stopping processing when it gets a false result if running in Eclipse
>> but it is when running under Maven 2. This is because "By default,
>> assertions are disabled at runtime"
>> So the assert statements really aren't doing what is expected.
>> As a result I've changing the use of assert to assertTrue for the unit
>> tests. The other advantage here is that we can attach a description to
>> the failure to assist in debugging. See
>> http://pcgen.svn.sourceforge.net/pcgen/?rev=11274&view=rev for what I
>> have updated.
>> From what I can see the 3 test classes updated in plugin.lsttokens.add
>> should be failing as they are flagging an invalid condition. Tom, could
>> you advise if this is a problem in the code or if the tests need to be
>> updated please?
>> James Dempsey
>> PCGen Code SB
- Hmm. Updated and looked at what is happening. It's a matter of using the method in two ways - one for valid, one for invalid. Leave the TODOs there and I'll look into the best way to test the grouping state.
--- In email@example.com, James Dempsey <jdempsey@...> wrote:
> From what I can see the 3 test classes updated in plugin.lsttokens.add
> should be failing as they are flagging an invalid condition. Tom, could
> you advise if this is a problem in the code or if the tests need to be
> updated please?