- A Sale instance s was created (instance creation).
- s was associated with the Register (association formed).
- Attributes of s were initialized.
Note the vague description in the last post-condition. If sufficient, this is fine.
On a project, all these particular postconditions are so obvious from the use case that the makeNewSale contract should probably not be written.
Recall one of the guiding principles of healthy process and the UP: Keep it as light as possible, and avoid all artifacts unless they really add value.
Contract CO2: enterItem
Operation:
enterItem(itemID : ItemID, quantity : integer)
Cross References:
Use Cases:
Process Sale
Preconditions:
There is a sale underway.
Postconditions:
- A SalesLineItem instance sli was created (instance creation).
- sli was associated with the current Sale (association formed).
- sli.quantity became quantity (attribute modification).
- sli was associated with a ProductSpecification, based on itemID match (association formed).
Contract CO3: endSale
Operation:
endSale()
Cross References:
Use Cases:
Process Sale
Preconditions:
There is a sale underway.
Postconditions:
- Sale.isComplete became true (attribute modification).
Contract CO4: makePayment
Operation:
makePayment( amount: Money )
Cross References:
Use Cases:
Process Sale
Preconditions:
There is a sale underway.
Postconditions:
- A Payment instance p was created (instance creation).
- p.amountTendered became amount (attribute modification).
- p was associated with the current Sale (association formed).
- The current Sale was associated with the Store (association formed); (to add it to the historical log of completed sales)