alexruiz / fest-assert-2.x

FEST Fluent Assertions 2.x
http://fest.easytesting.org
Apache License 2.0
401 stars 69 forks source link

number in range of #98

Open astubbs opened 12 years ago

astubbs commented 12 years ago

I don't think there's a test for number.inRange(x,y)? I'm doing two statements, one less than, one greater than.

joel-costigliola commented 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);
astubbs commented 12 years ago

Yeah, I can't think of anything better!..

isStrictlyInRange isn't as nice as isStrictlyBetween imo..

cowwoc commented 11 years ago

I am in favor of [inclusive, inclusive] bounds or [inclusive, exclusive[ which is common in Java.

joel-costigliola commented 11 years ago

FYI, is has been fixed in AssertJ 1.2.0 few months ago. (AssertJ is a fork of Fest Assert).

Regards,

Joel