Executed features | Passed | Failures | Errors | Skipped | Success rate | Time |
---|---|---|---|---|---|---|
2 | 2 | 0 | 0 | 0 | 100.0% | 0.031 seconds |
Side of surface
a positive number representing the side of the surface
should create an instance of Side class for a positive number
Return
(0.001 seconds)
|
|||||||||||||
When:
|
we create a side using a positive real number
|
||||||||||||
def side = Side.of(value as double) |
|||||||||||||
Then:
|
no exceptions are thrown
|
||||||||||||
notThrown IllegalArgumentException |
|||||||||||||
And:
|
we get an object of type side
|
||||||||||||
side instanceof Side |
|||||||||||||
And:
|
this object can be used as a regular high precision number
|
||||||||||||
side instanceof BigDecimal |
|||||||||||||
Examples:
|
|
5/5 passed
|
|||||||||||
should throw an exception for a negative or zero number
Return
(0.002 seconds)
|
|||||||||||||
When:
|
we are trying to create a side using a negative number or zero
|
||||||||||||
def side = Side.of(value) |
|||||||||||||
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
|