use of site.model.Session in project jprime by bgjug.
the class SessionControllerTest method shouldEditSession.
@Test
public void shouldEditSession() throws Exception {
Submission bootSubmission = bootSession.getSubmission();
mockMvc.perform(post("/admin/session/add").param("submission", bootSubmission.getId() + "").param("startTime", "27.05.2017 10:15").param("endTime", "27.05.2017 11:15").param("title", "").param("hall", betaHall.getId() + "").param("id", bootSession.getId() + "")).andExpect(status().isFound()).andExpect(view().name("redirect:/admin/session/view"));
List<Session> sessions = sessionRepository.findAll();
assertThat(sessions.size(), is(1));
Session session = sessions.get(0);
assertThat(session.getSubmission().getTitle(), is(bootSubmission.getTitle()));
assertThat(session.getStartTime(), is(new DateTime().withYear(2017).withMonthOfYear(5).withDayOfMonth(27).withHourOfDay(10).withMinuteOfHour(15).withSecondOfMinute(0).withMillisOfSecond(0)));
assertThat(session.getEndTime(), is(new DateTime().withYear(2017).withMonthOfYear(5).withDayOfMonth(27).withHourOfDay(11).withMinuteOfHour(15).withSecondOfMinute(0).withMillisOfSecond(0)));
assertThat(session.getHall().getName(), is(betaHall.getName()));
}
use of site.model.Session in project jprime by bgjug.
the class SessionControllerTest method shouldAddCoffeeBreak.
@Test
public void shouldAddCoffeeBreak() throws Exception {
mockMvc.perform(post("/admin/session/add").param("submission", "").param("startTime", "26.05.2017 10:15").param("endTime", "26.05.2017 11:15").param("title", "Coffee break").param("hall", "").param("id", "")).andExpect(status().isFound()).andExpect(view().name("redirect:/admin/session/view"));
List<Session> sessions = sessionRepository.findAll();
assertThat(sessions.size(), is(2));
Session session = sessions.get(1);
assertNull(session.getSubmission());
assertThat(session.getTitle(), is("Coffee break"));
assertThat(session.getStartTime(), is(new DateTime().withYear(2017).withMonthOfYear(5).withDayOfMonth(26).withHourOfDay(10).withMinuteOfHour(15).withSecondOfMinute(0).withMillisOfSecond(0)));
assertThat(session.getEndTime(), is(new DateTime().withYear(2017).withMonthOfYear(5).withDayOfMonth(26).withHourOfDay(11).withMinuteOfHour(15).withSecondOfMinute(0).withMillisOfSecond(0)));
assertNull(session.getHall());
}
Aggregations