Search in sources :

Example 6 with SmilImpl

use of org.opencastproject.smil.entity.SmilImpl in project opencast by opencast.

the class SmilResponseImplTest method testGetEntity.

/**
 * Test of getEntity method, of class SmilResponseImpl.
 */
@Test
public void testGetEntity() throws Exception {
    Smil smil = new SmilImpl();
    SmilResponse response = new SmilResponseImpl(smil);
    try {
        response.getEntity();
        fail("getEntity should fail, if entity count is zero");
    } catch (SmilException ex) {
    }
    response = new SmilResponseImpl(smil, smil.getBody());
    try {
        assertSame(smil.getBody(), response.getEntity());
        assertSame(1, response.getEntities().length);
        assertSame(smil.getBody(), response.getEntities()[0]);
    } catch (SmilException ex) {
        fail("getEntity should return the entity");
    }
    response = new SmilResponseImpl(smil, new SmilObject[] { smil.getHead(), smil.getBody() });
    try {
        response.getEntity();
        fail("get entity should fail if there are more then one entities set.");
    } catch (SmilException ex) {
    }
}
Also used : SmilResponse(org.opencastproject.smil.api.SmilResponse) SmilImpl(org.opencastproject.smil.entity.SmilImpl) SmilObject(org.opencastproject.smil.entity.api.SmilObject) Smil(org.opencastproject.smil.entity.api.Smil) SmilException(org.opencastproject.smil.api.SmilException) Test(org.junit.Test)

Aggregations

SmilImpl (org.opencastproject.smil.entity.SmilImpl)6 Test (org.junit.Test)5 SmilResponse (org.opencastproject.smil.api.SmilResponse)5 Smil (org.opencastproject.smil.entity.api.Smil)5 SmilObject (org.opencastproject.smil.entity.api.SmilObject)3 SmilException (org.opencastproject.smil.api.SmilException)2 JAXBException (javax.xml.bind.JAXBException)1 SmilHeadImpl (org.opencastproject.smil.entity.SmilHeadImpl)1