harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Zhang" <zhanghuang...@gmail.com>
Subject Re: [classlib] compatibility of toString
Date Sat, 01 Jul 2006 06:43:47 GMT
On 7/1/06, Alex Blewitt <alex.blewitt@gmail.com> wrote:
>
> I'd say that (like hashCode()) there's not a lot of point in testing
> the exact output, only behaviour. In other words, if it returns a
> String, that should be good enough. There's nothing in the spec to say
> what it should be -- all of the toString() methods could return
> "Harmony is Great!" and it'd still be within spec.


Agree. But there are always exceptions. Some "toString" methods have to
contain some key information as spec required, for example, the size or
index. However, it's still difficult to test the string information.
Generally speaking, I totally agree with you that "if it returns a String,
that should be good enough.".

BTW, are these toString information (RI) copyrighted?

Thanks!


> I suspect that tests that look at the exact output for toString() are
> being done because it may be a quick-and-dirty way of testing all
> properties set in a JavaBean-esque way.
>
> OTOH there are some things that probably are worth testing -- IIRC the
> XxxList implementations return [...] when the list grows beyond a
> certain size (1000?) to avoid doing an insane amount of toString
> calculation. That's the kind of property that I would expect to be
> tested in that particular test case.
>
> Alex.
>
> On 30/06/06, Alexei Zakharov <alexei.zakharov@gmail.com> wrote:
> > Hi community!
> >
> > While looking through some of java.beans tests I found many places
> > where exact output of toString() method is being tested. Moreover, the
> > test patterns differ from the output generated by RI's toString's.
> >
> > IMHO there is no much sense in testing of toString() since normally
> > users do not rely on it's output. However, I'd like to listen to
> > opinions. Does compatibility testing of toString() make sense to
> > anybody?
> >
> > --
> > Alexei Zakharov,
> > Intel Middleware Product Division
> >
> > ---------------------------------------------------------------------
> > Terms of use : http://incubator.apache.org/harmony/mailing.html
> > To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
> > For additional commands, e-mail: harmony-dev-help@incubator.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> Terms of use : http://incubator.apache.org/harmony/mailing.html
> To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
> For additional commands, e-mail: harmony-dev-help@incubator.apache.org
>
>


-- 
Andrew Zhang
China Software Development Lab, IBM

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message