SmilServiceImpl implements SmilService { @Override public SmilResponse removeSmilElement(Smil smil, String elementId) { SmilObject removed = ((SmilObjectImpl) smil).removeElement(elementId); if (removed == null) { return new SmilResponseImpl(smil); } else { return new SmilResponseImpl(smil, removed); } }  @Override SmilResponse createNewSmil(); @Override SmilResponse createNewSmil(MediaPackage mediaPackage); @Override SmilResponse addParallel(Smil smil); @Override SmilResponse addParallel(Smil smil, String parentId); @Override SmilResponse addSequence(Smil smil); @Override SmilResponse addSequence(Smil smil, String parentId); @Override SmilResponse addClip(Smil smil, String parentId, Track track, long start, long duration); @Override SmilResponse addClip(Smil smil, String parentId, Track track, long start, long duration, String pgId); @Override SmilResponse addClips(Smil smil, String parentId, Track[] tracks, long start, long duration); @Override SmilResponse addMeta(Smil smil, String name, String content); @Override SmilResponse removeSmilElement(Smil smil, String elementId); @Override SmilResponse fromXml(String smilXml); @Override SmilResponse fromXml(File smilXmlFile);  }
@Test public void testRemoveSmilElement() throws Exception { SmilResponse smilResponse = smilService.fromXml(TEST_SMIL); assertNotNull(smilResponse.getSmil()); SmilMediaContainer par = (SmilMediaContainer) smilResponse.getSmil().getBody().getMediaElements().get(0); assertSame(2, par.getElements().size()); smilResponse = smilService.removeSmilElement(smilResponse.getSmil(), par.getElements().get(0).getId()); assertTrue(smilResponse.getEntity() instanceof SmilMediaElement); assertSame(2, smilResponse.getSmil().getBody().getMediaElements().size()); par = (SmilMediaContainer) smilResponse.getSmil().getBody().getMediaElements().get(0); assertSame(1, par.getElements().size()); smilResponse = smilService.removeSmilElement(smilResponse.getSmil(), par.getId()); assertSame(1, smilResponse.getSmil().getBody().getMediaElements().size()); assertEquals(par.getId(), smilResponse.getEntity().getId()); smilResponse = smilService.removeSmilElement(smilResponse.getSmil(), par.getId()); assertSame(1, smilResponse.getSmil().getBody().getMediaElements().size()); assertSame(0, smilResponse.getEntitiesCount()); }