Update testMapEntry() for LANG-1736
This commit is contained in:
parent
82d91299f3
commit
0e42557d4a
|
@ -27,6 +27,7 @@ import java.util.HashMap;
|
|||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.apache.commons.lang3.AbstractLangTest;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
@ -101,6 +102,11 @@ public class PairTest extends AbstractLangTest {
|
|||
assertNotEquals(pair.hashCode(), pair2.hashCode());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConcurrentHashMapEntry() {
|
||||
testMapEntry(new ConcurrentHashMap<>());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEmptyArrayGenerics() {
|
||||
final Pair<Integer, String>[] empty = Pair.emptyArray();
|
||||
|
@ -127,11 +133,14 @@ public class PairTest extends AbstractLangTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testMapEntry() {
|
||||
final Pair<Integer, String> pair = ImmutablePair.of(0, "foo");
|
||||
final HashMap<Integer, String> map = new HashMap<>();
|
||||
public void testHashMapEntry() {
|
||||
testMapEntry(new HashMap<>());
|
||||
}
|
||||
|
||||
private void testMapEntry(final Map<Integer, String> map) {
|
||||
map.put(0, "foo");
|
||||
final Entry<Integer, String> entry = map.entrySet().iterator().next();
|
||||
final Pair<Integer, String> pair = ImmutablePair.of(0, "foo");
|
||||
assertEquals(pair, entry);
|
||||
assertEquals(pair.hashCode(), entry.hashCode());
|
||||
// LANG-1736:
|
||||
|
|
Loading…
Reference in New Issue