You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Jeff Varszegi <jv...@yahoo.com> on 2002/11/17 11:31:42 UTC
[collections] Trying to test the linked list, a question
All right, I have JUnit 3.8 installed. I read all the documentation on it and compiled and ran
some simple tests, but I'm having a minor problem.
I made a class named TestNodeCachingLinkedList that extends TestList (I attached it). It fails
twice with the same error, and I can't tell why it's happening. I know you're busy, but if you
could look at it I'd be much obliged. I don't know enough to tell if it's a fault in the test
script or not...
Here's the output of the script:
................F........................F.
.........................................
..................
Time: 0.3
There were 2 failures:
1) testListRemoveByIndex(TestNodeCachingLinkedList.testListRemoveByIndex)
junit.framework.AssertionFailedError: remove should return correct element expected:<null> but
was:<>
at org.apache.commons.collections.TestList.testListRemoveByIndex(TestList.java:699)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at
org.apache.commons.collections.TestNodeCachingLinkedList.main(TestNodeCachingLinkedList.java:32)
2) testListRemoveByIndex(TestNodeCachingLinkedList.bulkTestSubList.testListRemoveByIndex)
junit.framework.AssertionFailedError: remove should return correct element expected:<null> but
was:<Three>
at org.apache.commons.collections.TestList.testListRemoveByIndex(TestList.java:699)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at
org.apache.commons.collections.TestNodeCachingLinkedList.main(TestNodeCachingLinkedList.java:32)
FAILURES!!!
Tests run: 100, Failures: 2, Errors: 0
I looked all through the script of my class and I can't find anywhere it can construct a blank
string. I also couldn't find anything wrong in general; I checked over the logic pretty well, but
I guess it's always possible to miss something. Can anyone help me?
Jeff
P.S. I also attached the NodeCachingLinkedList class, latest version. It throws
NoSuchElementException everywhere that it should. JKV
--- Stephen Colebourne <sc...@btopenworld.com> wrote:
> From: "Jeff Varszegi" <jv...@yahoo.com>
> > Can you tell me more about the unit testing?
> See the JUnit website if you've never used it before. However its easy to
> get to grips with.
>
> Collections uses JUnit with an abstract superclass. The superclass aims to
> test compliance with the List interface spec (for example), leaving the
> individual test class to just test for the differences in that particular
> implementation. You'll need to have a look at some of the classes in the
> test package to figure it out (as I wasn't involved with the test structure
> that was created) I believe that BulkTest is a significant class, but don't
> hold me to it ;-)
>
> Stephen
>
>
> --
> To unsubscribe, e-mail: <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
__________________________________________________
Do you Yahoo!?
Yahoo! Web Hosting - Let the expert host your site
http://webhosting.yahoo.com
Re: [collections] Trying to test the linked list, a question
Posted by Jeff Varszegi <jv...@yahoo.com>.
I was just wondering if you happened to look at the speed improvements I suggested for
FastArrayList. I know you're busy, just wondering. If it's not seen as important I won't
continue on with my plan of performance-tuning some of the other classes in Collections. (That's
not a huffy statement, but sincere-- I don't want to waste everyone's time, and I'd rather help
out in a valuable way.) I just like to tinker with things to make them fast, and I thought maybe
I could have a good impact on a few projects at once by speeding up some of the Collections
classes that are reused.
Jeff
__________________________________________________
Do you Yahoo!?
Yahoo! Web Hosting - Let the expert host your site
http://webhosting.yahoo.com
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: [collections] Trying to test the linked list, a question
Posted by Stephen Colebourne <sc...@btopenworld.com>.
From: "Jeff Varszegi" <jv...@yahoo.com>
> I looked all through the script of my class and I can't find anywhere it
can construct a blank
> string. I also couldn't find anything wrong in general; I checked over
the logic pretty well, but
> I guess it's always possible to miss something. Can anyone help me?
TestCollection.getFullNonNullElements() contains the values that are
failing. At some point they get added to a reference collection (ArrayList)
and your collection (NodeCachingLinkedList) - testList.makeFullList().
This uses addAll() to add and the testRemoveByIndex uses an iterator(). One
of those two must be failing. All I can suggest is following the path of the
data from the getFullNonNullElements() to the failure.
Stephen
> Jeff
>
> P.S. I also attached the NodeCachingLinkedList class, latest version. It
throws
> NoSuchElementException everywhere that it should. JKV
>
> --- Stephen Colebourne <sc...@btopenworld.com> wrote:
> > From: "Jeff Varszegi" <jv...@yahoo.com>
> > > Can you tell me more about the unit testing?
> > See the JUnit website if you've never used it before. However its easy
to
> > get to grips with.
> >
> > Collections uses JUnit with an abstract superclass. The superclass aims
to
> > test compliance with the List interface spec (for example), leaving the
> > individual test class to just test for the differences in that
particular
> > implementation. You'll need to have a look at some of the classes in the
> > test package to figure it out (as I wasn't involved with the test
structure
> > that was created) I believe that BulkTest is a significant class, but
don't
> > hold me to it ;-)
> >
> > Stephen
> >
> >
> > --
> > To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> > For additional commands, e-mail:
<ma...@jakarta.apache.org>
> >
>
>
>
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Web Hosting - Let the expert host your site
> http://webhosting.yahoo.com
----------------------------------------------------------------------------
----
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>