Search in sources :

Example 6 with Session

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()));
}
Also used : Submission(site.model.Submission) DateTime(org.joda.time.DateTime) Session(site.model.Session) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 7 with Session

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());
}
Also used : DateTime(org.joda.time.DateTime) Session(site.model.Session) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

Session (site.model.Session)7 DateTime (org.joda.time.DateTime)4 Test (org.junit.Test)4 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)4 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)2 Submission (site.model.Submission)2 Before (org.junit.Before)1 Speaker (site.model.Speaker)1 VenueHall (site.model.VenueHall)1