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.53 by jsr166, Fri May 15 18:21:19 2015 UTC vs.
Revision 1.54 by jsr166, Fri Sep 4 19:35:46 2015 UTC

# Line 1331 | Line 1331 | public class ThreadPoolExecutorTest exte
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
1363       * when given a negative value
1364       */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines