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

Szabolcs Ferenczi szabolcs.ferenczi at gmail.com
Sun Apr 15 15:59:07 EDT 2007


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: /pipermail/attachments/20070415/fb67afe4/attachment.html 


More information about the Concurrency-interest mailing list