@Test public void shouldNotLeakOnConststructEnd() throws Exception { Date end = new Date(); Duration dur = new Duration(new Date(), end); end.setTime(100); Assert.assertNotEquals(end, dur.getEnd()); }
@Override public ConferenceRepresentation from(UriInfo uriInfo, Conference source) { ConferenceRepresentation rep = new ConferenceRepresentation(source.getId(), uriInfo); rep.setName(source.getName()); rep.setTagLine(source.getTagLine()); if(source.getDuration() != null) { rep.setStart(source.getDuration().getStart()); rep.setEnd(source.getDuration().getEnd()); } return rep; }
@Override protected ResponseSpecification responseValidation(ResponseSpecification spec, Session session) { return spec. root("session"). body("title", equalTo(session.getTitle())). body("outline", equalTo(session.getOutline())). body("start", equalToXmlDate(session.getDuration().getStart())). body("end", equalToXmlDate(session.getDuration().getEnd())); } }
@Override protected ResponseSpecification responseValidation(ResponseSpecification spec, Conference conference) { return spec. root("conference"). body("name", equalTo(conference.getName())). body("tagLine", equalTo(conference.getTagLine())). body("start", equalToXmlDate(conference.getDuration().getStart())). body("end", equalToXmlDate(conference.getDuration().getEnd())); }
@Override public SessionRepresentation from(UriInfo uriInfo, Session source) { String id = source.getId(); String parentId = null; if(source.getConference() != null) { parentId = source.getConference().getId(); } SessionRepresentation rep = new SessionRepresentation(id, parentId, uriInfo); rep.setTitle(source.getTitle()); rep.setOutline(source.getOutline()); if(source.getDuration() != null) { rep.setStart(source.getDuration().getStart()); rep.setEnd(source.getDuration().getEnd()); } return rep; }