@Test @Transactional public void getDTUser() throws Exception { // Initialize the database dTUserRepository.saveAndFlush(dTUser); // Get the dTUser restDTUserMockMvc .perform(get("/api/dTUsers/{id}", dTUser.getId())) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andExpect(jsonPath("$.id").value(dTUser.getId().intValue())) .andExpect(jsonPath("$.username").value(DEFAULT_USERNAME.toString())) .andExpect(jsonPath("$.password").value(DEFAULT_PASSWORD.toString())) .andExpect(jsonPath("$.avatar").value(DEFAULT_AVATAR.toString())) .andExpect(jsonPath("$.phone").value(DEFAULT_PHONE.toString())) .andExpect(jsonPath("$.sign").value(DEFAULT_SIGN.toString())) .andExpect(jsonPath("$.birthday").value(DEFAULT_BIRTHDAY.toString())); }
@Before public void initTest() { dTUser = new DTUser(); dTUser.setUsername(DEFAULT_USERNAME); dTUser.setPassword(DEFAULT_PASSWORD); dTUser.setAvatar(DEFAULT_AVATAR); dTUser.setPhone(DEFAULT_PHONE); dTUser.setSign(DEFAULT_SIGN); dTUser.setBirthday(DEFAULT_BIRTHDAY); }
@Test @Transactional public void deleteDTUser() throws Exception { // Initialize the database dTUserRepository.saveAndFlush(dTUser); int databaseSizeBeforeDelete = dTUserRepository.findAll().size(); // Get the dTUser restDTUserMockMvc .perform(delete("/api/dTUsers/{id}", dTUser.getId()).accept(TestUtil.APPLICATION_JSON_UTF8)) .andExpect(status().isOk()); // Validate the database is empty List<DTUser> dTUsers = dTUserRepository.findAll(); assertThat(dTUsers).hasSize(databaseSizeBeforeDelete - 1); }
@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); }
@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); }