@Before public void initTest() { shipOrder = new ShipOrder(); shipOrder.setDeliveryTimeStamp(DEFAULT_DELIVERY_TIME_STAMP); shipOrder.setFinalCosts(DEFAULT_FINAL_COSTS); shipOrder.setReadyForShipping(DEFAULT_READY_FOR_SHIPPING); }
@Test @Transactional public void getShipOrder() throws Exception { // Initialize the database shipOrderRepository.saveAndFlush(shipOrder); // Get the shipOrder restShipOrderMockMvc .perform(get("/api/shipOrders/{id}", shipOrder.getId())) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andExpect(jsonPath("$.id").value(shipOrder.getId().intValue())) .andExpect(jsonPath("$.deliveryTimeStamp").value(DEFAULT_DELIVERY_TIME_STAMP.toString())) .andExpect(jsonPath("$.finalCosts").value(DEFAULT_FINAL_COSTS.doubleValue())) .andExpect(jsonPath("$.readyForShipping").value(DEFAULT_READY_FOR_SHIPPING.booleanValue())); }
@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); }
@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); }
@Test @Transactional public void deleteShipOrder() throws Exception { // Initialize the database shipOrderRepository.saveAndFlush(shipOrder); int databaseSizeBeforeDelete = shipOrderRepository.findAll().size(); // Get the shipOrder restShipOrderMockMvc .perform( delete("/api/shipOrders/{id}", shipOrder.getId()) .accept(TestUtil.APPLICATION_JSON_UTF8)) .andExpect(status().isOk()); // Validate the database is empty List<ShipOrder> shipOrders = shipOrderRepository.findAll(); assertThat(shipOrders).hasSize(databaseSizeBeforeDelete - 1); }