@Test @Transactional public void updateCourse() throws Exception { // Initialize the database courseRepository.saveAndFlush(course); int databaseSizeBeforeUpdate = courseRepository.findAll().size(); // Update the course course.setTitle(UPDATED_TITLE); restCourseMockMvc .perform( put("/api/courses") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(course))) .andExpect(status().isOk()); // Validate the Course in the database List<Course> courses = courseRepository.findAll(); assertThat(courses).hasSize(databaseSizeBeforeUpdate); Course testCourse = courses.get(courses.size() - 1); assertThat(testCourse.getTitle()).isEqualTo(UPDATED_TITLE); }
@Before public void initTest() { course = new Course(); course.setTitle(DEFAULT_TITLE); }