You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Phil Steitz <ph...@steitz.com> on 2003/12/13 21:45:48 UTC

[lang] JUnit version, broken tests

Some tests (/builder/ShortPrefixToStringStyleTest, ArrayUtils.Test) have 
been been added/modified to require Junit 3.8.  I have no problem with 
this; but we need to modify the dependency in project.xml for the maven 
build to work in this case.  Any objections to this change?

I am seeing the following failure in the builder tests:

Testcase: testNestedBroken took 0.006 sec
	FAILED
expected:<0> but was:<3>
junit.framework.AssertionFailedError: expected:<0> but was:<3>
	at org.apache.commons.lang.enum.EnumTest.testNestedBroken(EnumTest.java:432)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

I am using Sun Linux JDK 1.4.2

Phil


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


Re: [lang] JUnit version, broken tests

Posted by Phil Steitz <ph...@steitz.com>.
__matthewHawthorne wrote:
> 
> 
> Phil Steitz wrote:
> 
>> __matthewHawthorne wrote:
>>
>>> Instead of removing it, is it possible to modify the test to "expect" 
>>> the failure?  I'm not familiar with the test or class that you're 
>>> speaking of, but sometimes it's nice to keep tests like this around.
>>>
>>> Maybe catch an expected RuntimeException, or change an assertTrue to 
>>> an assertFalse, etc.?
>>>
>>>
> 
>> The problem is that the test case testNestedBroken in 
>> o.a.c.l.enum.EnumTest is expecting "broken" behavior which does not 
>> occur under (Sun Linux) jdk 1.4.2.  There is not much else in the test 
>> case. That's why I suggested removing it.
>>
>> Phil
> 
> 
> Ah, now I understand.  Since it's such a specific test, you're probably 
> right, it makes sense to remove it.  Either that, or perhaps you could 
> use SystemUtils to only run the test if it's on the expected version and 
> platform.
> 

I have now tried with JDK 1.4.1 and am seeing the same result.  The first 
assertion in EnumTest.testNestedBroken fails:

  public void testNestedBroken() {
    List list = new ArrayList(NestBroken.ColorEnum.getEnumList());
    assertEquals(0, list.size());  // no enums!!! <--- FAILS for me
    // this is BROKEN because the enum constants are defined in a DIFFERENT
    // class from getEnumList(). Once NestBroken class is referenced,
    // and thus class loaded with its enum constants, the getEnumList works

This fails when the tests are run from Ant or Maven, SUN Linux JDKs 
1.4.1_06, 1.4.2-b28.  The list has size 3, which is what it "should" have 
(i.e., the broken behavior is not happening).

I don't want to just remove the test, since it is supposed to be 
illustrating a problem referenced in PR #23374.

Any ideas on how to fix this?

Looks like the nightly build is working, btw. What platform and JDK does 
the nightly build use?

Phil

> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> 




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


Re: [lang] JUnit version, broken tests

Posted by __matthewHawthorne <ma...@phreaker.net>.

Phil Steitz wrote:
> __matthewHawthorne wrote:
> 
>> Instead of removing it, is it possible to modify the test to "expect" 
>> the failure?  I'm not familiar with the test or class that you're 
>> speaking of, but sometimes it's nice to keep tests like this around.
>>
>> Maybe catch an expected RuntimeException, or change an assertTrue to 
>> an assertFalse, etc.?
>>
>>

> The problem is that the test case testNestedBroken in 
> o.a.c.l.enum.EnumTest is expecting "broken" behavior which does not 
> occur under (Sun Linux) jdk 1.4.2.  There is not much else in the test 
> case. That's why I suggested removing it.
> 
> Phil

Ah, now I understand.  Since it's such a specific test, you're probably 
right, it makes sense to remove it.  Either that, or perhaps you could 
use SystemUtils to only run the test if it's on the expected version and 
platform.


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


Re: [lang] JUnit version, broken tests

Posted by Phil Steitz <ph...@steitz.com>.
__matthewHawthorne wrote:
> Instead of removing it, is it possible to modify the test to "expect" 
> the failure?  I'm not familiar with the test or class that you're 
> speaking of, but sometimes it's nice to keep tests like this around.
> 
> Maybe catch an expected RuntimeException, or change an assertTrue to an 
> assertFalse, etc.?
> 
> 

The problem is that the test case testNestedBroken in 
o.a.c.l.enum.EnumTest is expecting "broken" behavior which does not occur 
under (Sun Linux) jdk 1.4.2.  There is not much else in the test case. 
That's why I suggested removing it.

Phil


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


Re: [lang] JUnit version, broken tests

Posted by __matthewHawthorne <ma...@phreaker.net>.
Instead of removing it, is it possible to modify the test to "expect" 
the failure?  I'm not familiar with the test or class that you're 
speaking of, but sometimes it's nice to keep tests like this around.

Maybe catch an expected RuntimeException, or change an assertTrue to an 
assertFalse, etc.?




Phil Steitz wrote:
> Stephen Colebourne wrote:
> 
>> +1, enough time has now passed for JUnit3.8 to be OK
>>
>> Stephen
> 
> 
> Done.  The enum test remains broken, however under JDK 1.4.2.
> 
> The test that is failing was added to demonstrate the problem referenced 
> in PR 23374.  Since it fails (actually just fails to demonstrate 
> "broken" behavior) under 1.4.2, I would like to remove it.  Any 
> objections to this?
> 
> Phil
> 
>>
>> ----- Original Message -----
>> From: "Phil Steitz" <ph...@steitz.com>
>> To: "Jakarta Commons Developers List" <co...@jakarta.apache.org>
>> Sent: Saturday, December 13, 2003 8:45 PM
>> Subject: [lang] JUnit version, broken tests
>>
>>
>>
>>> Some tests (/builder/ShortPrefixToStringStyleTest, ArrayUtils.Test) have
>>> been been added/modified to require Junit 3.8.  I have no problem with
>>> this; but we need to modify the dependency in project.xml for the maven
>>> build to work in this case.  Any objections to this change?
>>>
>>> I am seeing the following failure in the builder tests:
>>>
>>> Testcase: testNestedBroken took 0.006 sec
>>> FAILED
>>> expected:<0> but was:<3>
>>> junit.framework.AssertionFailedError: expected:<0> but was:<3>
>>> at
>>
>>
>> org.apache.commons.lang.enum.EnumTest.testNestedBroken(EnumTest.java:432)
>>
>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>> at
>>>
>>
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39 
>>
>> )
>>
>>> at
>>>
>>
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl 
>>
>> .java:25)
>>
>>> I am using Sun Linux JDK 1.4.2
>>>
>>> Phil
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>>


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


Re: [lang] JUnit version, broken tests

Posted by Phil Steitz <ph...@steitz.com>.
Stephen Colebourne wrote:
> +1, enough time has now passed for JUnit3.8 to be OK
> 
> Stephen

Done.  The enum test remains broken, however under JDK 1.4.2.

The test that is failing was added to demonstrate the problem referenced 
in PR 23374.  Since it fails (actually just fails to demonstrate "broken" 
behavior) under 1.4.2, I would like to remove it.  Any objections to this?

Phil

> 
> ----- Original Message -----
> From: "Phil Steitz" <ph...@steitz.com>
> To: "Jakarta Commons Developers List" <co...@jakarta.apache.org>
> Sent: Saturday, December 13, 2003 8:45 PM
> Subject: [lang] JUnit version, broken tests
> 
> 
> 
>>Some tests (/builder/ShortPrefixToStringStyleTest, ArrayUtils.Test) have
>>been been added/modified to require Junit 3.8.  I have no problem with
>>this; but we need to modify the dependency in project.xml for the maven
>>build to work in this case.  Any objections to this change?
>>
>>I am seeing the following failure in the builder tests:
>>
>>Testcase: testNestedBroken took 0.006 sec
>>FAILED
>>expected:<0> but was:<3>
>>junit.framework.AssertionFailedError: expected:<0> but was:<3>
>>at
> 
> org.apache.commons.lang.enum.EnumTest.testNestedBroken(EnumTest.java:432)
> 
>>at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>at
>>
> 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
> )
> 
>>at
>>
> 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
> .java:25)
> 
>>I am using Sun Linux JDK 1.4.2
>>
>>Phil
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>>
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> 




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


Re: [lang] JUnit version, broken tests

Posted by Stephen Colebourne <sc...@btopenworld.com>.
+1, enough time has now passed for JUnit3.8 to be OK

Stephen

----- Original Message -----
From: "Phil Steitz" <ph...@steitz.com>
To: "Jakarta Commons Developers List" <co...@jakarta.apache.org>
Sent: Saturday, December 13, 2003 8:45 PM
Subject: [lang] JUnit version, broken tests


> Some tests (/builder/ShortPrefixToStringStyleTest, ArrayUtils.Test) have
> been been added/modified to require Junit 3.8.  I have no problem with
> this; but we need to modify the dependency in project.xml for the maven
> build to work in this case.  Any objections to this change?
>
> I am seeing the following failure in the builder tests:
>
> Testcase: testNestedBroken took 0.006 sec
> FAILED
> expected:<0> but was:<3>
> junit.framework.AssertionFailedError: expected:<0> but was:<3>
> at
org.apache.commons.lang.enum.EnumTest.testNestedBroken(EnumTest.java:432)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
>
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
> at
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
>
> I am using Sun Linux JDK 1.4.2
>
> Phil
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>


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