Open astubbs opened 12 years ago
No we don't have one, I have two options in mind :
assertThat(myNumber).isInRange(5, 10);
or
assertThat(myNumber).isBetween(5, 10);
I think both are clear.
One question though : are boundaries included or not ? I would say they should be, if we want to exclude them we could add 'strictly' in the assertion, e.g :
// would fail if myNumber == 5 or 10
assertThat(myNumber).isStrictlyBetween(5, 10);
Yeah, I can't think of anything better!..
isStrictlyInRange isn't as nice as isStrictlyBetween imo..
I am in favor of [inclusive, inclusive] bounds or [inclusive, exclusive[ which is common in Java.
FYI, is has been fixed in AssertJ 1.2.0 few months ago. (AssertJ is a fork of Fest Assert).
Regards,
Joel
I don't think there's a test for number.inRange(x,y)? I'm doing two statements, one less than, one greater than.