void (ExecutorService executor) { if (executor instanceof ScheduledExecutorService s) { UsefulTestCase.assertThrows(RejectedExecutionException.class, () -> s.schedule(EmptyRunnable.getInstance(), 10, TimeUnit.SECONDS)); UsefulTestCase.assertThrows(RejectedExecutionException.class, () -> s.schedule(()->null, 10, TimeUnit.SECONDS)); UsefulTestCase.assertThrows(IncorrectOperationException.class, "bad for hibernation", () -> s.scheduleAtFixedRate(()->{}, 10, 1, TimeUnit.SECONDS)); UsefulTestCase.assertThrows(RejectedExecutionException.class, () -> s.scheduleWithFixedDelay(()->{}, 10, 1, TimeUnit.SECONDS)); } UsefulTestCase.assertThrows(RejectedExecutionException.class, () -> executor.execute(EmptyRunnable.getInstance())); UsefulTestCase.assertThrows(RejectedExecutionException.class, () -> executor.submit(EmptyRunnable.getInstance())); UsefulTestCase.assertThrows(RejectedExecutionException.class, () -> executor.invokeAny(Collections.singletonList(()->null))); UsefulTestCase.assertThrows(RejectedExecutionException.class, () -> executor.invokeAny(Collections.singletonList(()->null), 1, TimeUnit.NANOSECONDS)); UsefulTestCase.assertThrows(RejectedExecutionException.class, () -> executor.invokeAll(Collections.singletonList(()->null))); UsefulTestCase.assertThrows(RejectedExecutionException.class, () -> executor.invokeAll(Collections.singletonList(()->null), 1, TimeUnit.NANOSECONDS)); }