コード例 #1
0
  @Test
  @Transactional
  public void updateShipOrder() throws Exception {
    // Initialize the database
    shipOrderRepository.saveAndFlush(shipOrder);

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

    // Update the shipOrder
    shipOrder.setDeliveryTimeStamp(UPDATED_DELIVERY_TIME_STAMP);
    shipOrder.setFinalCosts(UPDATED_FINAL_COSTS);
    shipOrder.setReadyForShipping(UPDATED_READY_FOR_SHIPPING);

    restShipOrderMockMvc
        .perform(
            put("/api/shipOrders")
                .contentType(TestUtil.APPLICATION_JSON_UTF8)
                .content(TestUtil.convertObjectToJsonBytes(shipOrder)))
        .andExpect(status().isOk());

    // Validate the ShipOrder in the database
    List<ShipOrder> shipOrders = shipOrderRepository.findAll();
    assertThat(shipOrders).hasSize(databaseSizeBeforeUpdate);
    ShipOrder testShipOrder = shipOrders.get(shipOrders.size() - 1);
    assertThat(testShipOrder.getDeliveryTimeStamp()).isEqualTo(UPDATED_DELIVERY_TIME_STAMP);
    assertThat(testShipOrder.getFinalCosts()).isEqualTo(UPDATED_FINAL_COSTS);
    assertThat(testShipOrder.getReadyForShipping()).isEqualTo(UPDATED_READY_FOR_SHIPPING);
  }
コード例 #2
0
  @Test
  @Transactional
  public void createShipOrder() throws Exception {
    int databaseSizeBeforeCreate = shipOrderRepository.findAll().size();

    // Create the ShipOrder

    restShipOrderMockMvc
        .perform(
            post("/api/shipOrders")
                .contentType(TestUtil.APPLICATION_JSON_UTF8)
                .content(TestUtil.convertObjectToJsonBytes(shipOrder)))
        .andExpect(status().isCreated());

    // Validate the ShipOrder in the database
    List<ShipOrder> shipOrders = shipOrderRepository.findAll();
    assertThat(shipOrders).hasSize(databaseSizeBeforeCreate + 1);
    ShipOrder testShipOrder = shipOrders.get(shipOrders.size() - 1);
    assertThat(testShipOrder.getDeliveryTimeStamp()).isEqualTo(DEFAULT_DELIVERY_TIME_STAMP);
    assertThat(testShipOrder.getFinalCosts()).isEqualTo(DEFAULT_FINAL_COSTS);
    assertThat(testShipOrder.getReadyForShipping()).isEqualTo(DEFAULT_READY_FOR_SHIPPING);
  }