Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IQueue accepts null values from HazelcastClient #7048

Closed
tlamerig opened this issue Dec 10, 2015 · 1 comment · Fixed by #7052
Closed

IQueue accepts null values from HazelcastClient #7048

tlamerig opened this issue Dec 10, 2015 · 1 comment · Fixed by #7052
Assignees
Milestone

Comments

@tlamerig
Copy link

public class IQueueTest {
    private static final String Q = "q";
    private HazelcastInstance instance;
    private HazelcastInstance client;

    @Before
    public void setUp() throws Exception {
        instance = Hazelcast.newHazelcastInstance();
        client = HazelcastClient.newHazelcastClient();
    }

    @After
    public void tearDown() throws Exception {
        client.shutdown();
        instance.shutdown();
    }

    @Test(expected = NullPointerException.class)
    public void addNullShouldThrow() throws Exception {
        IQueue<String> myQueue = client.getQueue(Q);
        myQueue.add(null);
    }

    @Test(expected = NullPointerException.class)
    public void putNullShouldThrow() throws Exception {
        IQueue<String> myQueue = client.getQueue(Q);
        myQueue.put(null);
    }

    @Test(expected = NullPointerException.class)
    public void queueShouldNotBeAbleToContainNull() throws Exception {
        BlockingQueue<String> q = client.getQueue(Q);
        q.add(null);
        q.add("hello");
        assertEquals(2, q.size());
        q.poll();
        String hello = q.poll();
        assertEquals("hello", hello);
    }
}
@pveentjer
Copy link
Contributor

Thanks for reporting these bugs! There is a PR pending with the fix.

@jerrinot jerrinot added this to the 3.6 milestone Dec 11, 2015
pveentjer added a commit to pveentjer/hazelcast that referenced this issue Dec 11, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants