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