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.52 by jsr166, Fri May 15 17:07:27 2015 UTC vs.
Revision 1.54 by jsr166, Fri Sep 4 19:35:46 2015 UTC

# Line 1264 | Line 1264 | public class ThreadPoolExecutorTest exte
1264       */
1265      public void testExecuteNull() {
1266          ThreadPoolExecutor p =
1267 <            new ThreadPoolExecutor(1, 2,
1268 <                                   LONG_DELAY_MS, MILLISECONDS,
1267 >            new ThreadPoolExecutor(1, 2, 1L, SECONDS,
1268                                     new ArrayBlockingQueue<Runnable>(10));
1269          try {
1270              p.execute(null);
# Line 1330 | Line 1329 | public class ThreadPoolExecutorTest exte
1329          }
1330          joinPool(p);
1331      }
1332 +
1333 +    /**
1334 +     * Configuration changes that allow core pool size greater than
1335 +     * max pool size result in IllegalArgumentException.
1336 +     */
1337 +    public void testPoolSizeInvariants() {
1338 +        ThreadPoolExecutor p =
1339 +            new ThreadPoolExecutor(1, 1,
1340 +                                   LONG_DELAY_MS, MILLISECONDS,
1341 +                                   new ArrayBlockingQueue<Runnable>(10));
1342 +        for (int s = 1; s < 5; s++) {
1343 +            p.setMaximumPoolSize(s);
1344 +            p.setCorePoolSize(s);
1345 +            try {
1346 +                p.setMaximumPoolSize(s - 1);
1347 +                shouldThrow();
1348 +            } catch (IllegalArgumentException success) {}
1349 +            assertEquals(s, p.getCorePoolSize());
1350 +            assertEquals(s, p.getMaximumPoolSize());
1351 +            try {
1352 +                p.setCorePoolSize(s + 1);
1353 +                shouldThrow();
1354 +            } catch (IllegalArgumentException success) {}
1355 +            assertEquals(s, p.getCorePoolSize());
1356 +            assertEquals(s, p.getMaximumPoolSize());
1357 +        }
1358 +        joinPool(p);
1359 +    }
1360  
1361      /**
1362       * setKeepAliveTime throws IllegalArgumentException

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines