public class SchedulerTest extends TestCase {
public void testNaturalOrdering() throws Exception {
Scheduler<XAResourceHolderState> resourceScheduler = new Scheduler<XAResourceHolderState>();
XAResourceHolderState xarhs0 = new XAResourceHolderState(null, new MockResourceBean(1));
XAResourceHolderState xarhs1 = new XAResourceHolderState(null, new MockResourceBean(1));
XAResourceHolderState xarhs2 = new XAResourceHolderState(null, new MockResourceBean(1));
XAResourceHolderState xarhs3 = new XAResourceHolderState(null, new MockResourceBean(0));
XAResourceHolderState xarhs4 = new XAResourceHolderState(null, new MockResourceBean(10));
resourceScheduler.add(xarhs0, xarhs0.getTwoPcOrderingPosition());
resourceScheduler.add(xarhs1, xarhs1.getTwoPcOrderingPosition());
resourceScheduler.add(xarhs2, xarhs2.getTwoPcOrderingPosition());
resourceScheduler.add(xarhs3, xarhs3.getTwoPcOrderingPosition());
resourceScheduler.add(xarhs4, xarhs4.getTwoPcOrderingPosition());
assertEquals("a Scheduler with 5 object(s) in 3 position(s)", resourceScheduler.toString());
/* testing natural order priorities */
assertEquals(5, resourceScheduler.size());