static void testExec(Agent agent, String expected, boolean expectedReturn, TaskSpec spec) throws Exception {
        ByteArrayOutputStream b = new ByteArrayOutputStream();
        PrintStream p = new PrintStream(b, true, StandardCharsets.UTF_8.toString());
        boolean actualReturn = agent.exec(spec, p);
        assertEquals(expected, b.toString());
        assertEquals(expectedReturn, actualReturn);
    }
Modify sleep() to call super.sleep() every second call
in order to avoid the endless loop in the tick() calls to the MockScheduler listener
trogdor/src/test/java/org/apache/kafka/trogdor/agent/AgentTest.java