SmilServiceImpl implements SmilService { @Override public SmilResponse fromXml(String smilXml) throws SmilException { try { return new SmilResponseImpl(SmilImpl.fromXML(smilXml)); } catch (JAXBException ex) { throw new SmilException("Parsing SMIL document failed.", ex); } }  @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 testFromXml() throws Exception { SmilResponse smilResponse = smilService.fromXml(TEST_SMIL); assertNotNull(smilResponse.getSmil()); Smil smil = smilResponse.getSmil(); assertSame(2, smil.getHead().getParamGroups().size()); assertSame(2, smil.getBody().getMediaElements().size()); assertTrue(smil.getBody().getMediaElements().get(0) instanceof SmilMediaParallelImpl); assertTrue(smil.getBody().getMediaElements().get(1) instanceof SmilMediaParallelImpl); SmilMediaContainer par = (SmilMediaContainer) smil.getBody().getMediaElements().get(0); assertSame(2, par.getElements().size()); assertTrue(par.getElements().get(0) instanceof SmilMediaVideoImpl); assertTrue(par.getElements().get(1) instanceof SmilMediaAudioImpl); }