コード例 #1
0
  @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);
  }
コード例 #2
0
  @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);
  }
コード例 #3
0
  @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);
  }