[concurrency-interest] LinkedBlockingQueue does not throw NullPointerException for the method call contains

Joe Bowbeer joe.bowbeer at gmail.com
Sun Apr 15 16:37:54 EDT 2007


Where is the null inserted in your test?

LinkedBlockingQueue(3) contains 0 elements...

On 4/15/07, Szabolcs Ferenczi <szabolcs.ferenczi at gmail.com> wrote:
> I am trying to test LinkedBlockingQueue and I cannot get the null
> pointer test for the method contains through:
>
> public class lbqTest {
>
>     LinkedBlockingQueue q;
>
>     @Before
>     public void setUp() {
>          q = new LinkedBlockingQueue(3);
>     }
>
>     @Test (expected=NullPointerException.class)
>     public void seqContainsNull() {
>          q.contains(null);
>     }
> ...
> }
>
> What I receive is this:
>
> There was 1 failure:
> 1) seqContainsNull(lbqTest.lbqTest)
> java.lang.AssertionError: Expected exception: java.lang.NullPointerException
>
> I would expect a successful test according to the documentation of the
> method.
>
> What is wrong?
>
> Best Regards,
> Szabolcs
>


More information about the Concurrency-interest mailing list