Esempio n. 1
0
  @Test
  @Transactional
  public void createForum() throws Exception {
    int databaseSizeBeforeCreate = forumRepository.findAll().size();

    // Create the Forum
    restForumMockMvc
        .perform(
            post("/api/forums")
                .contentType(TestUtil.APPLICATION_JSON_UTF8)
                .content(TestUtil.convertObjectToJsonBytes(forum)))
        .andExpect(status().isCreated());

    // Validate the Forum in the database
    List<Forum> forums = forumRepository.findAll();
    assertThat(forums).hasSize(databaseSizeBeforeCreate + 1);
    Forum testForum = forums.get(forums.size() - 1);
    assertThat(testForum.getName()).isEqualTo(DEFAULT_NAME);
    assertThat(testForum.getDescription()).isEqualTo(DEFAULT_DESCRIPTION);
    assertThat(testForum.getDisplay()).isEqualTo(DEFAULT_DISPLAY);
    assertThat(testForum.getLft()).isEqualTo(DEFAULT_LFT);
    assertThat(testForum.getRgt()).isEqualTo(DEFAULT_RGT);
    assertThat(testForum.getPostCount()).isEqualTo(DEFAULT_POST_COUNT);
    assertThat(testForum.getTopicCount()).isEqualTo(DEFAULT_TOPIC_COUNT);
    assertThat(testForum.getLocked()).isEqualTo(DEFAULT_LOCKED);
  }
Esempio n. 2
0
  @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);
  }