/** Tests the relocation of guides. */ public void testRelocateGuide() { IGuide guide1 = new DummyEmptyGuide(); guide1.setTitle("1"); IGuide guide2 = new DummyEmptyGuide(); guide2.setTitle("2"); // Add one guide and relocate it to the same position set.add(guide1); set.relocateGuide(guide1, 0); assertEquals("Wrong guides count.", 1, set.getGuidesCount()); assertTrue("Wrong guide.", set.getGuideAt(0) == guide1); // Add another guide and check two relocations: back and forth set.add(guide2); set.relocateGuide(guide1, 1); assertEquals("Wrong guides count.", 2, set.getGuidesCount()); assertTrue("Wrong guide.", set.getGuideAt(0) == guide2); assertTrue("Wrong guide.", set.getGuideAt(1) == guide1); set.relocateGuide(guide1, 0); assertEquals("Wrong guides count.", 2, set.getGuidesCount()); assertTrue("Wrong guide.", set.getGuideAt(0) == guide1); assertTrue("Wrong guide.", set.getGuideAt(1) == guide2); }
/** Tests the addition of guides to the set. */ public void testAdd() { DummyEmptyGuide guide = new DummyEmptyGuide(); set.add(guide); assertEquals("Guide isn't added.", 1, set.getGuidesCount()); assertTrue("Wrong guide is added.", guide == set.getGuideAt(0)); }
/** Tests removing of the guides from the set. */ public void testRemove() { DummyEmptyGuide guide = new DummyEmptyGuide(); guide.setTitle("1"); set.add(guide); set.add(new DummyEmptyGuide()); set.remove(guide); assertEquals("Guide wasn't removed.", 1, set.getGuidesCount()); assertFalse("Wrong guide was removed.", guide == set.getGuideAt(0)); }