ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/jtreg/util/Hashtable/IllegalLoadFactor.java
(Generate patch)

Comparing jsr166/src/test/jtreg/util/Hashtable/IllegalLoadFactor.java (file contents):
Revision 1.3 by jsr166, Sun Sep 5 21:32:19 2010 UTC vs.
Revision 1.5 by jsr166, Sun Oct 11 00:58:42 2015 UTC

# Line 26 | Line 26
26     @summary Test for an illegalargumentexception on loadFactor
27   */
28  
29
30
29   import java.util.*;
30  
31   /**
# Line 38 | Line 36 | public class IllegalLoadFactor {
36  
37        public static void main(String argv[]) throws Exception {
38            boolean testSucceeded = false;
39 <          try{
39 >          try {
40                // this should generate an IllegalArgumentException
41                Hashtable bad1 = new Hashtable(100, -3);
42            }
# Line 49 | Line 47 | public class IllegalLoadFactor {
47                throw new Exception("Hashtable, negative load factor");
48  
49            testSucceeded = false;
50 <          try{
50 >          try {
51                // this should generate an IllegalArgumentException
52                Hashtable bad1 = new Hashtable(100, Float.NaN);
53            }
# Line 60 | Line 58 | public class IllegalLoadFactor {
58                throw new Exception("Hashtable, NaN load factor");
59  
60            testSucceeded = false;
61 <          try{
61 >          try {
62                // this should generate an IllegalArgumentException
63                HashMap bad1 = new HashMap(100, -3);
64            }
# Line 71 | Line 69 | public class IllegalLoadFactor {
69                throw new Exception("HashMap, negative load factor");
70  
71            testSucceeded = false;
72 <          try{
72 >          try {
73                // this should generate an IllegalArgumentException
74                HashMap bad1 = new HashMap(100, Float.NaN);
75            }
# Line 83 | Line 81 | public class IllegalLoadFactor {
81  
82  
83            testSucceeded = false;
84 <          try{
84 >          try {
85                // this should generate an IllegalArgumentException
86                HashSet bad1 = new HashSet(100, -3);
87            }
# Line 94 | Line 92 | public class IllegalLoadFactor {
92                throw new Exception("HashSet, negative load factor");
93  
94            testSucceeded = false;
95 <          try{
95 >          try {
96                // this should generate an IllegalArgumentException
97                HashSet bad1 = new HashSet(100, Float.NaN);
98            }
# Line 105 | Line 103 | public class IllegalLoadFactor {
103                throw new Exception("HashSet, NaN load factor");
104  
105            testSucceeded = false;
106 <          try{
106 >          try {
107                // this should generate an IllegalArgumentException
108                WeakHashMap bad1 = new WeakHashMap(100, -3);
109            }
# Line 116 | Line 114 | public class IllegalLoadFactor {
114                throw new Exception("WeakHashMap, negative load factor");
115  
116            testSucceeded = false;
117 <          try{
117 >          try {
118                // this should generate an IllegalArgumentException
119                WeakHashMap bad1 = new WeakHashMap(100, Float.NaN);
120            }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines