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.10 by dl, Sat Nov 1 18:37:02 2003 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines