[concurrency-interest] LinkedBlockingQueue does not throw ClassCastException

David Holmes dcholmes at optusnet.com.au
Mon Apr 16 19:24:48 EDT 2007


I don't think you get it.

You can test for optional behaviour but you need to know by some mechanism
which option the implementation has chosen. Of course you can expand your
test to allow any of the optional behaviours as meaning the test passed.

If a collection implementation can choose to throw ClassCastException if an
element of the wrong type is inserted, then you need to know:
a) that the collection you were given made that choice; and
b) what types it disallows

Then you can test that it does what it was specified to do.

I don't think there is anything else I can say.

David

> -----Original Message-----
> From: Szabolcs Ferenczi [mailto:szabolcs.ferenczi at gmail.com]
> Sent: Tuesday, 17 April 2007 9:17 AM
> To: dholmes at ieee.org
> Cc: Concurrency-interest at cs.oswego.edu
> Subject: Re: [concurrency-interest] LinkedBlockingQueue does not throw
> ClassCastException
>
>
> On 17/04/07, David Holmes <dcholmes at optusnet.com.au> wrote:
> > You cannot test an unknown concrete implementation against
> optional parts of
> > the specification.
>
> Well, I can test it, if it is specified, i.e. if it is intended to be
> used. On the other hand, if the specification says that it behaves so
> if you like so but it behaves otherwise, if you like it otherwise,
> then, of course, I cannot test it. You are right there. Sorry that I
> was trying to take it seriously.
>
> Best Regards,
> Szabolcs



More information about the Concurrency-interest mailing list