@Before public void initTest() { bloodPressure = new BloodPressure(); bloodPressure.setTimestamp(DEFAULT_TIMESTAMP); bloodPressure.setSystolic(DEFAULT_SYSTOLIC); bloodPressure.setDiastolic(DEFAULT_DIASTOLIC); }
@Test @Transactional public void getBloodPressure() throws Exception { // Initialize the database bloodPressureRepository.saveAndFlush(bloodPressure); // Get the bloodPressure restBloodPressureMockMvc .perform(get("/api/bloodPressures/{id}", bloodPressure.getId())) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andExpect(jsonPath("$.id").value(bloodPressure.getId().intValue())) .andExpect(jsonPath("$.timestamp").value(DEFAULT_TIMESTAMP_STR)) .andExpect(jsonPath("$.systolic").value(DEFAULT_SYSTOLIC)) .andExpect(jsonPath("$.diastolic").value(DEFAULT_DIASTOLIC)); }
@Test @Transactional public void updateBloodPressure() throws Exception { // Initialize the database bloodPressureRepository.saveAndFlush(bloodPressure); int databaseSizeBeforeUpdate = bloodPressureRepository.findAll().size(); // Update the bloodPressure bloodPressure.setTimestamp(UPDATED_TIMESTAMP); bloodPressure.setSystolic(UPDATED_SYSTOLIC); bloodPressure.setDiastolic(UPDATED_DIASTOLIC); restBloodPressureMockMvc .perform( put("/api/bloodPressures") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(bloodPressure))) .andExpect(status().isOk()); // Validate the BloodPressure in the database List<BloodPressure> bloodPressures = bloodPressureRepository.findAll(); assertThat(bloodPressures).hasSize(databaseSizeBeforeUpdate); BloodPressure testBloodPressure = bloodPressures.get(bloodPressures.size() - 1); assertThat(testBloodPressure.getTimestamp()).isEqualTo(UPDATED_TIMESTAMP); assertThat(testBloodPressure.getSystolic()).isEqualTo(UPDATED_SYSTOLIC); assertThat(testBloodPressure.getDiastolic()).isEqualTo(UPDATED_DIASTOLIC); }
@Test @Transactional public void createBloodPressure() throws Exception { int databaseSizeBeforeCreate = bloodPressureRepository.findAll().size(); // Create the BloodPressure restBloodPressureMockMvc .perform( post("/api/bloodPressures") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(bloodPressure))) .andExpect(status().isCreated()); // Validate the BloodPressure in the database List<BloodPressure> bloodPressures = bloodPressureRepository.findAll(); assertThat(bloodPressures).hasSize(databaseSizeBeforeCreate + 1); BloodPressure testBloodPressure = bloodPressures.get(bloodPressures.size() - 1); assertThat(testBloodPressure.getTimestamp()).isEqualTo(DEFAULT_TIMESTAMP); assertThat(testBloodPressure.getSystolic()).isEqualTo(DEFAULT_SYSTOLIC); assertThat(testBloodPressure.getDiastolic()).isEqualTo(DEFAULT_DIASTOLIC); }
@Test @Transactional public void deleteBloodPressure() throws Exception { // Initialize the database bloodPressureRepository.saveAndFlush(bloodPressure); int databaseSizeBeforeDelete = bloodPressureRepository.findAll().size(); // Get the bloodPressure restBloodPressureMockMvc .perform( delete("/api/bloodPressures/{id}", bloodPressure.getId()) .accept(TestUtil.APPLICATION_JSON_UTF8)) .andExpect(status().isOk()); // Validate the database is empty List<BloodPressure> bloodPressures = bloodPressureRepository.findAll(); assertThat(bloodPressures).hasSize(databaseSizeBeforeDelete - 1); }