@Test @Transactional public void updateSession() throws Exception { // Initialize the database sessionRepository.saveAndFlush(session); int databaseSizeBeforeUpdate = sessionRepository.findAll().size(); // Update the session session.setSessionName(UPDATED_SESSION_NAME); session.setStartTime(UPDATED_START_TIME); session.setEndTime(UPDATED_END_TIME); session.setIsBreak(UPDATED_IS_BREAK); restSessionMockMvc .perform( put("/api/sessions") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(session))) .andExpect(status().isOk()); // Validate the Session in the database List<Session> sessions = sessionRepository.findAll(); assertThat(sessions).hasSize(databaseSizeBeforeUpdate); Session testSession = sessions.get(sessions.size() - 1); assertThat(testSession.getSessionName()).isEqualTo(UPDATED_SESSION_NAME); assertThat(testSession.getStartTime()).isEqualTo(UPDATED_START_TIME); assertThat(testSession.getEndTime()).isEqualTo(UPDATED_END_TIME); assertThat(testSession.getIsBreak()).isEqualTo(UPDATED_IS_BREAK); }
@Before public void initTest() { session = new Session(); session.setSessionName(DEFAULT_SESSION_NAME); session.setStartTime(DEFAULT_START_TIME); session.setEndTime(DEFAULT_END_TIME); session.setIsBreak(DEFAULT_IS_BREAK); }