Executed features | Passed | Failures | Errors | Skipped | Success rate | Time |
---|---|---|---|---|---|---|
2 | 2 | 0 | 0 | 0 | 100.0% | 0.039 seconds |
Bonus from vendor
a positive number representing a bonus from the vendor for the work performed
should create an instance of VendorBonus for a positive number
Return
(0.001 seconds)
|
|||||||||||||
When:
|
we create a vendor bonus using a positive number
|
||||||||||||
def bonus = VendorBonus.of(value as double) |
|||||||||||||
Then:
|
the object created successfully, no exceptions was thrown
|
||||||||||||
notThrown IllegalArgumentException |
|||||||||||||
And:
|
this object can be used as a regular high precision number
|
||||||||||||
bonus instanceof BigDecimal |
|||||||||||||
Where:
|
various positive numbers
|
||||||||||||
Examples:
|
|
5/5 passed
|
|||||||||||
should throw an exception for a negative number
Return
(0.002 seconds)
|
|||||||||||||
When:
|
we are trying to create a vendor bonus using a negative number
|
||||||||||||
def bonus = VendorBonus.of(value as double) |
|||||||||||||
Then:
|
we cannot create this object and an exception is thrown
|
||||||||||||
def message = thrown IllegalArgumentException |
|||||||||||||
And:
|
the error message indicates the reason for the exception
|
||||||||||||
message =~ "must be a positive" |
|||||||||||||
Examples:
|
|
4/4 passed
|