@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 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);
  }
  @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 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));
  }
  private void createBloodPressureByMonth(
      ZonedDateTime firstOfMonth, ZonedDateTime firstDayOfLastMonth) {
    User user = userRepository.findOneByLogin("user").get();
    // this month
    bloodPressure = new BloodPressure(firstOfMonth, 120, 80, user);
    bloodPressureRepository.saveAndFlush(bloodPressure);
    bloodPressure = new BloodPressure(firstOfMonth.plusDays(10), 125, 75, user);
    bloodPressureRepository.saveAndFlush(bloodPressure);
    bloodPressure = new BloodPressure(firstOfMonth.plusDays(20), 100, 69, user);
    bloodPressureRepository.saveAndFlush(bloodPressure);

    // last month
    bloodPressure = new BloodPressure(firstDayOfLastMonth, 130, 90, user);
    bloodPressureRepository.saveAndFlush(bloodPressure);
    bloodPressure = new BloodPressure(firstDayOfLastMonth.plusDays(11), 135, 85, user);
    bloodPressureRepository.saveAndFlush(bloodPressure);
    bloodPressure = new BloodPressure(firstDayOfLastMonth.plusDays(23), 130, 75, user);
    bloodPressureRepository.saveAndFlush(bloodPressure);
  }