@Test @Transactional public void updateDTUser() throws Exception { // Initialize the database dTUserRepository.saveAndFlush(dTUser); int databaseSizeBeforeUpdate = dTUserRepository.findAll().size(); // Update the dTUser dTUser.setUsername(UPDATED_USERNAME); dTUser.setPassword(UPDATED_PASSWORD); dTUser.setAvatar(UPDATED_AVATAR); dTUser.setPhone(UPDATED_PHONE); dTUser.setSign(UPDATED_SIGN); dTUser.setBirthday(UPDATED_BIRTHDAY); restDTUserMockMvc .perform( put("/api/dTUsers") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(dTUser))) .andExpect(status().isOk()); // Validate the DTUser in the database List<DTUser> dTUsers = dTUserRepository.findAll(); assertThat(dTUsers).hasSize(databaseSizeBeforeUpdate); DTUser testDTUser = dTUsers.get(dTUsers.size() - 1); assertThat(testDTUser.getUsername()).isEqualTo(UPDATED_USERNAME); assertThat(testDTUser.getPassword()).isEqualTo(UPDATED_PASSWORD); assertThat(testDTUser.getAvatar()).isEqualTo(UPDATED_AVATAR); assertThat(testDTUser.getPhone()).isEqualTo(UPDATED_PHONE); assertThat(testDTUser.getSign()).isEqualTo(UPDATED_SIGN); assertThat(testDTUser.getBirthday()).isEqualTo(UPDATED_BIRTHDAY); }
@Test @Transactional public void createDTUser() throws Exception { int databaseSizeBeforeCreate = dTUserRepository.findAll().size(); // Create the DTUser restDTUserMockMvc .perform( post("/api/dTUsers") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(dTUser))) .andExpect(status().isCreated()); // Validate the DTUser in the database List<DTUser> dTUsers = dTUserRepository.findAll(); assertThat(dTUsers).hasSize(databaseSizeBeforeCreate + 1); DTUser testDTUser = dTUsers.get(dTUsers.size() - 1); assertThat(testDTUser.getUsername()).isEqualTo(DEFAULT_USERNAME); assertThat(testDTUser.getPassword()).isEqualTo(DEFAULT_PASSWORD); assertThat(testDTUser.getAvatar()).isEqualTo(DEFAULT_AVATAR); assertThat(testDTUser.getPhone()).isEqualTo(DEFAULT_PHONE); assertThat(testDTUser.getSign()).isEqualTo(DEFAULT_SIGN); assertThat(testDTUser.getBirthday()).isEqualTo(DEFAULT_BIRTHDAY); }