public JobControl(JobControlState state) {
        this.state = Objects.requireNonNull(state);
    }
@Test
    public void testJobControl() {
        JobControlStateMock state = new JobControlStateMock();
        JobControl jobControl = new JobControl(state);

        String job1 = "Job1";
        String job2 = "Job2";
        TestMaintainer maintainer1 = new TestMaintainer(job1, jobControl, new NoopJobMetrics());
        TestMaintainer maintainer2 = new TestMaintainer(job2, jobControl, new NoopJobMetrics());
        assertEquals(2, jobControl.jobs().size());
        assertTrue(jobControl.jobs().contains(job1));
        assertTrue(jobControl.jobs().contains(job2));

        assertTrue(jobControl.isActive(job1));
        assertTrue(jobControl.isActive(job2));

        state.setActive(job1, false);
        assertFalse(jobControl.isActive(job1));
        assertTrue(jobControl.isActive(job2));

        state.setActive(job2, false);
        assertFalse(jobControl.isActive(job1));
        assertFalse(jobControl.isActive(job2));

        state.setActive(job1, true);
        assertTrue(jobControl.isActive(job1));
        assertFalse(jobControl.isActive(job2));

        state.setActive(job2, true);
        assertTrue(jobControl.isActive(job1));
        assertTrue(jobControl.isActive(job2));

        // Run jobs on-demand
        jobControl.run(job1);
        jobControl.run(job1);
        assertEquals(2, maintainer1.totalRuns());
        jobControl.run(job2);
        assertEquals(1, maintainer2.totalRuns());

        // Running jobs on-demand ignores inactive flag
        state.setActive(job1, false);
        jobControl.run(job1);
        assertEquals(3, maintainer1.totalRuns());
    }