Ejemplo n.º 1
0
  @Test
  @Transactional
  public void updateCoupon() throws Exception {
    // Initialize the database
    couponRepository.saveAndFlush(coupon);

    int databaseSizeBeforeUpdate = couponRepository.findAll().size();

    // Update the coupon
    coupon.setCode(UPDATED_CODE);
    coupon.setPassword(UPDATED_PASSWORD);
    coupon.setCategory(UPDATED_CATEGORY);
    coupon.setStatus(STATUS.Unused);
    restCouponMockMvc
        .perform(
            put("/api/coupons")
                .contentType(TestUtil.APPLICATION_JSON_UTF8)
                .content(TestUtil.convertObjectToJsonBytes(coupon)))
        .andExpect(status().isOk());

    // Validate the Coupon in the database
    List<Coupon> coupons = couponRepository.findAll();
    assertThat(coupons).hasSize(databaseSizeBeforeUpdate);
    Coupon testCoupon = coupons.get(coupons.size() - 1);
    assertThat(testCoupon.getCode()).isEqualTo(UPDATED_CODE);
    assertThat(testCoupon.getPassword()).isEqualTo(UPDATED_PASSWORD);
    assertThat(testCoupon.getCategory()).isEqualTo(UPDATED_CATEGORY);
    assertThat(testCoupon.getStatus()).isEqualTo(UPDATED_STATUS);
  }
Ejemplo n.º 2
0
 @Before
 public void initTest() {
   coupon = new Coupon();
   coupon.setCode(DEFAULT_CODE);
   coupon.setPassword(DEFAULT_PASSWORD);
   coupon.setCategory(DEFAULT_CATEGORY);
   coupon.setStatus(STATUS.Unused);
 }