@Test public void testCaptionSetterAndGetter() throws Exception { assertNull(l.getCaption()); ImageCaptionImpl caption = (ImageCaptionImpl) TestHelperDoc.genElem("imgcaption"); l.setCaption(caption); assertTrue(caption == l.getCaption()); assertTrue(caption == l.getFirstChild()); assertTrue(caption == l.getLastChild()); l.setCaption(null); assertNull(l.getCaption()); assertNull(l.getFirstChild()); assertNull(l.getLastChild()); }
@Test public void testReplaceCaption() throws Exception { ImageCaptionImpl caption = (ImageCaptionImpl) TestHelperDoc.genElem("imgcaption"); l.setCaption(caption); ImageCaptionImpl newCaption = (ImageCaptionImpl) TestHelperDoc.genElem("imgcaption"); l.replaceChild(newCaption, caption); assertTrue(newCaption == l.getCaption()); assertTrue(newCaption == l.getFirstChild()); assertTrue(newCaption == l.getLastChild()); }