commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Carman <>
Subject Re: svn commit: r983219 - /commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/
Date Sun, 08 Aug 2010 21:34:43 GMT
To make sure I'm actually passing in the exact same values (by letting
the compiler create the arrays using the varargs feature) I added the
following output to the startsWithAny() method:

System.out.println("startsWithAny(): Received " + string + " input
with " + (searchStrings == null ? null :
Arrays.asList(searchStrings).toString()) + " input array");

When running the old version of the test code to the new version,
there was no difference in the output.

I also ran a similar test by changing getCommonPrefix() method:

System.out.println("getCommonPrefix(): Received " + (strs == null ?
null : Arrays.asList(strs).toString()) + " input array");

Again, no changes in the output.  So, we're at least exercising the
"guts" of the methods the same.  Now I can understand that you might
be saying that we're not exercising how the code is called the same
way in both cases, but the varargs support vs. the manual array
creation is identical.  If you think we should add back in the manual
String[] stuff, I guess we could, but I really don't see much value in
it other than testing that varargs == manual String[].

On Sun, Aug 8, 2010 at 4:26 PM, James Carman <> wrote:
> On Sun, Aug 8, 2010 at 1:39 PM, sebb <> wrote:
>>> +        assertFalse(StringUtils.startsWithAny("abcxyz", null, "xyz", "abcd"));
>> Most of the above changes seem wrong to me, as they change what is being tested.
>> By all means add tests for varargs, but surely the array tests need to
>> be kept as well?
> How do they change what is being tested exactly?

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message