ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/tck/ThreadPoolExecutorTest.java
(Generate patch)

Comparing jsr166/src/test/tck/ThreadPoolExecutorTest.java (file contents):
Revision 1.8 by dl, Sun Oct 5 23:00:40 2003 UTC vs.
Revision 1.9 by dl, Sun Oct 5 23:55:03 2003 UTC

# Line 177 | Line 177 | public class ThreadPoolExecutorTest exte
177          }
178      }
179  
180 +
181 +    /**
182 +     * getRejectedExecutionHandler returns handler in constructor if not set
183 +     */
184 +    public void testGetRejectedExecutionHandler() {
185 +        RejectedExecutionHandler h = new NoOpREHandler();
186 +        ThreadPoolExecutor p = new ThreadPoolExecutor(1,2,LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10), h);
187 +        assertSame(h, p.getRejectedExecutionHandler());
188 +        p.shutdown();
189 +        joinPool(p);
190 +    }
191 +
192 +    /**
193 +     * setRejectedExecutionHandler sets the handler returned by
194 +     * getRejectedExecutionHandler
195 +     */
196 +    public void testSetRejectedExecutionHandler() {
197 +        ThreadPoolExecutor p = new ThreadPoolExecutor(1,2,LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
198 +        RejectedExecutionHandler h = new NoOpREHandler();
199 +        p.setRejectedExecutionHandler(h);
200 +        assertSame(h, p.getRejectedExecutionHandler());
201 +        p.shutdown();
202 +        joinPool(p);
203 +    }
204 +
205 +
206 +    /**
207 +     * setRejectedExecutionHandler(null) throws NPE
208 +     */
209 +    public void testSetRejectedExecutionHandlerNull() {
210 +        ThreadPoolExecutor p = new ThreadPoolExecutor(1,2,LONG_DELAY_MS, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
211 +        try {
212 +            p.setRejectedExecutionHandler(null);
213 +            shouldThrow();
214 +        } catch (NullPointerException success) {
215 +        } finally {
216 +            joinPool(p);
217 +        }
218 +    }
219 +
220      
221      /**
222       *   getLargestPoolSize increases, but doesn't overestimate, when

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines