blob: e77f0d0057822aafd0e3cf05041331e15afa05c3 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.prelude.test;
import org.junit.Test;
import java.util.HashSet;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
/**
* Tests null members in HashSet
*/
public class NullSetMemberTestCase {
@Test
public void testNullMember() {
HashSet<?> s = new HashSet<>();
assertEquals(s.size(), 0);
assertFalse(s.contains(null));
s.add(null);
assertEquals(s.size(), 1);
assertTrue(s.contains(null));
}
}
|