@Before public void initTest() { forum = new Forum(); forum.setName(DEFAULT_NAME); forum.setDescription(DEFAULT_DESCRIPTION); forum.setDisplay(DEFAULT_DISPLAY); forum.setLft(DEFAULT_LFT); forum.setRgt(DEFAULT_RGT); forum.setPostCount(DEFAULT_POST_COUNT); forum.setTopicCount(DEFAULT_TOPIC_COUNT); forum.setLocked(DEFAULT_LOCKED); }
@Test @Transactional public void updateForum() throws Exception { // Initialize the database forumRepository.saveAndFlush(forum); int databaseSizeBeforeUpdate = forumRepository.findAll().size(); // Update the forum forum.setName(UPDATED_NAME); forum.setDescription(UPDATED_DESCRIPTION); forum.setDisplay(UPDATED_DISPLAY); forum.setLft(UPDATED_LFT); forum.setRgt(UPDATED_RGT); forum.setPostCount(UPDATED_POST_COUNT); forum.setTopicCount(UPDATED_TOPIC_COUNT); forum.setLocked(UPDATED_LOCKED); restForumMockMvc .perform( put("/api/forums") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(forum))) .andExpect(status().isOk()); // Validate the Forum in the database List<Forum> forums = forumRepository.findAll(); assertThat(forums).hasSize(databaseSizeBeforeUpdate); Forum testForum = forums.get(forums.size() - 1); assertThat(testForum.getName()).isEqualTo(UPDATED_NAME); assertThat(testForum.getDescription()).isEqualTo(UPDATED_DESCRIPTION); assertThat(testForum.getDisplay()).isEqualTo(UPDATED_DISPLAY); assertThat(testForum.getLft()).isEqualTo(UPDATED_LFT); assertThat(testForum.getRgt()).isEqualTo(UPDATED_RGT); assertThat(testForum.getPostCount()).isEqualTo(UPDATED_POST_COUNT); assertThat(testForum.getTopicCount()).isEqualTo(UPDATED_TOPIC_COUNT); assertThat(testForum.getLocked()).isEqualTo(UPDATED_LOCKED); }