public SizedScheduledExecutorService(ScheduledThreadPoolExecutor delegate, long queueSize) {
        this.delegate = delegate;
        this.queueSize = queueSize;
    }
@Test
    public void testSizedScheduledExecutorService() {
        ScheduledThreadPoolExecutor delegate = new ScheduledThreadPoolExecutor(5);

        SizedScheduledExecutorService sized = new SizedScheduledExecutorService(delegate, 2);

        Runnable task = new Runnable() {
            @Override
            public void run() {
                // noop
            }
        };

        sized.schedule(task, 2, TimeUnit.SECONDS);
        sized.schedule(task, 3, TimeUnit.SECONDS);

        RejectedExecutionException e
                = assertThrows(RejectedExecutionException.class, () -> sized.schedule(task, 4, TimeUnit.SECONDS),
                        "Should have thrown a RejectedExecutionException");
        assertEquals("Task rejected due queue size limit reached", e.getMessage());

        sized.shutdownNow();
        assertTrue(sized.isShutdown() || sized.isTerminating(), "Should be shutdown");
        assertTrue(delegate.isShutdown() || sized.isTerminating(), "Should be shutdown");
    }