Search in sources :

Example 1 with OrderApprovalState

use of org.estatio.module.capex.dom.order.approval.OrderApprovalState in project estatio by estatio.

the class OrderRepository_Test method upsert_when_already_exists.

@Test
public void upsert_when_already_exists() throws Exception {
    // given
    OrderRepository orderRepository = new OrderRepository() {

        @Override
        public Order findByOrderNumber(final String orderNumber) {
            return order;
        }
    };
    String number = "some number";
    String sellerOrderReference = "ref";
    LocalDate entryDate = new LocalDate(2017, 1, 1);
    LocalDate orderDate = new LocalDate(2017, 1, 2);
    Party seller = new Organisation();
    Party buyer = new Organisation();
    Property property = new Property();
    String atPath = "atPath";
    OrderApprovalState approvalState = OrderApprovalState.APPROVED;
    assertThat(order.getOrderNumber()).isNull();
    // when
    orderRepository.upsert(property, number, sellerOrderReference, entryDate, orderDate, seller, buyer, atPath, approvalState);
    // then
    assertThat(order.getOrderNumber()).isNull();
    assertThat(order.getSellerOrderReference()).isEqualTo(sellerOrderReference);
    assertThat(order.getEntryDate()).isEqualTo(entryDate);
    assertThat(order.getOrderDate()).isEqualTo(orderDate);
    assertThat(order.getSeller()).isEqualTo(seller);
    assertThat(order.getBuyer()).isEqualTo(buyer);
    assertThat(order.getProperty()).isEqualTo(property);
    assertThat(order.getAtPath()).isEqualTo(atPath);
    // is ignored.
    assertThat(order.getApprovalState()).isNull();
}
Also used : Party(org.estatio.module.party.dom.Party) Organisation(org.estatio.module.party.dom.Organisation) LocalDate(org.joda.time.LocalDate) Property(org.estatio.module.asset.dom.Property) OrderApprovalState(org.estatio.module.capex.dom.order.approval.OrderApprovalState) Test(org.junit.Test)

Aggregations

Property (org.estatio.module.asset.dom.Property)1 OrderApprovalState (org.estatio.module.capex.dom.order.approval.OrderApprovalState)1 Organisation (org.estatio.module.party.dom.Organisation)1 Party (org.estatio.module.party.dom.Party)1 LocalDate (org.joda.time.LocalDate)1 Test (org.junit.Test)1