@Test
  public void testStart() throws Exception {
    RoundRobinSchedulerStats stats =
        EasyMock.createMockBuilder(RoundRobinSchedulerStats.class)
            .withConstructor()
            .addMockedMethod("registerMBean")
            .addMockedMethod("createMovingAverage")
            .createStrictMock();

    MovingAverage mavg = EasyMock.createStrictMock(MovingAverage.class);
    EasyMock.expect(stats.createMovingAverage()).andReturn(mavg);
    mavg.startTimer("RoundRobinAddMavg", stats.getAddMavgPeriod(), TimeUnit.MILLISECONDS);
    EasyMock.expectLastCall();

    stats.registerMBean();
    EasyMock.expectLastCall();

    EasyMock.replay(stats, mavg);
    stats.start();
    EasyMock.verify(stats, mavg);
    assertEquals("Mavg not set.", mavg, stats.m_addMavg);

    // with already called
    EasyMock.reset(stats, mavg);
    EasyMock.replay(stats, mavg);
    stats.start();
    EasyMock.verify(stats, mavg);
  }
  @Test
  public void testConstructor() throws Exception {
    RoundRobinSchedulerStats stats = new RoundRobinSchedulerStats();
    assertFalse("JMX should not be enabled by default.", stats.isUseJMX());

    stats.setUseJMX(true);
    assertTrue("JMX should be enabled.", stats.isUseJMX());
    assertEquals("Wrong default mavg period.", 300000, stats.getAddMavgPeriod());
    assertNull("Mavg should not be created.", stats.m_addMavg);
    assertEquals("Wrong default mavg sample size.", 360, stats.getAddMavgSampleSize());
  }