6 |
|
* Pat Fisher, Mike Judd. |
7 |
|
*/ |
8 |
|
|
9 |
< |
import junit.framework.*; |
10 |
< |
import java.util.*; |
9 |
> |
import java.util.ArrayList; |
10 |
> |
import java.util.Arrays; |
11 |
> |
import java.util.Collection; |
12 |
> |
import java.util.Collections; |
13 |
> |
import java.util.Enumeration; |
14 |
> |
import java.util.Iterator; |
15 |
> |
import java.util.Map; |
16 |
> |
import java.util.Random; |
17 |
> |
import java.util.Set; |
18 |
|
import java.util.concurrent.ConcurrentHashMap; |
19 |
|
|
20 |
+ |
import junit.framework.Test; |
21 |
+ |
import junit.framework.TestSuite; |
22 |
+ |
|
23 |
|
public class ConcurrentHashMapTest extends JSR166TestCase { |
24 |
|
public static void main(String[] args) { |
25 |
|
junit.textui.TestRunner.run(suite()); |
287 |
|
assertEquals("A", (String)map.get(one)); |
288 |
|
ConcurrentHashMap empty = new ConcurrentHashMap(); |
289 |
|
assertNull(map.get("anything")); |
290 |
+ |
assertNull(empty.get("anything")); |
291 |
|
} |
292 |
|
|
293 |
|
/** |
538 |
|
try { |
539 |
|
new ConcurrentHashMap(-1, .75f); |
540 |
|
shouldThrow(); |
541 |
< |
} catch (IllegalArgumentException e) {} |
541 |
> |
} catch (IllegalArgumentException success) {} |
542 |
|
|
543 |
|
try { |
544 |
|
new ConcurrentHashMap(16, -1); |
545 |
|
shouldThrow(); |
546 |
< |
} catch (IllegalArgumentException e) {} |
546 |
> |
} catch (IllegalArgumentException success) {} |
547 |
|
} |
548 |
|
|
549 |
|
/** |
554 |
|
try { |
555 |
|
new ConcurrentHashMap(-1, .75f, 1); |
556 |
|
shouldThrow(); |
557 |
< |
} catch (IllegalArgumentException e) {} |
557 |
> |
} catch (IllegalArgumentException success) {} |
558 |
|
|
559 |
|
try { |
560 |
|
new ConcurrentHashMap(16, -1, 1); |
561 |
|
shouldThrow(); |
562 |
< |
} catch (IllegalArgumentException e) {} |
562 |
> |
} catch (IllegalArgumentException success) {} |
563 |
|
|
564 |
|
try { |
565 |
|
new ConcurrentHashMap(16, .75f, -1); |
566 |
|
shouldThrow(); |
567 |
< |
} catch (IllegalArgumentException e) {} |
567 |
> |
} catch (IllegalArgumentException success) {} |
568 |
|
} |
569 |
|
|
570 |
|
/** |
575 |
|
try { |
576 |
|
new ConcurrentHashMap(null); |
577 |
|
shouldThrow(); |
578 |
< |
} catch (NullPointerException e) {} |
578 |
> |
} catch (NullPointerException success) {} |
579 |
|
} |
580 |
|
|
581 |
|
/** |
590 |
|
assertFalse(map2.equals(map1)); |
591 |
|
} |
592 |
|
|
582 |
– |
|
593 |
|
/** |
594 |
|
* get(null) throws NPE |
595 |
|
*/ |