use of org.opencastproject.usertracking.api.UserAction in project opencast by opencast.
the class UserActionImplTest method testForwardLength.
/**
* Ensures a positive length user action calculates its length correctly.
*/
@Test
public void testForwardLength() {
UserSession us = new UserSessionImpl();
us.setSessionId("4");
us.setUserId("testing user");
us.setUserIp("127.0.0.1");
UserAction ua = new UserActionImpl();
ua.setId(4L);
ua.setInpoint(90);
ua.setIsPlaying(true);
ua.setMediapackageId("false");
ua.setOutpoint(100);
ua.setSession(us);
ua.setType("test");
Assert.assertEquals(new Long(4), ua.getId());
Assert.assertEquals(90, ua.getInpoint());
Assert.assertEquals(true, ua.getIsPlaying());
Assert.assertEquals("false", ua.getMediapackageId());
Assert.assertEquals(100, ua.getOutpoint());
Assert.assertEquals("4", ua.getSession().getSessionId());
Assert.assertEquals("test", ua.getType());
Assert.assertEquals("testing user", ua.getSession().getUserId());
Assert.assertEquals("127.0.0.1", ua.getSession().getUserIp());
Assert.assertEquals(10, ua.getLength());
}
Aggregations