@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());
  // remove first element from parallel
  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());
  // remove parallel from smil
  smilResponse = smilService.removeSmilElement(smilResponse.getSmil(), par.getId());
  assertSame(1, smilResponse.getSmil().getBody().getMediaElements().size());
  assertEquals(par.getId(), smilResponse.getEntity().getId());
  // remove the same parallel again
  // should not fail
  // response should return the same smil without entities
  smilResponse = smilService.removeSmilElement(smilResponse.getSmil(), par.getId());
  assertSame(1, smilResponse.getSmil().getBody().getMediaElements().size());
  assertSame(0, smilResponse.getEntitiesCount());
}