| 1 | |
package net.sf.cotta.test.assertion; |
| 2 | |
|
| 3 | |
import org.hamcrest.BaseMatcher; |
| 4 | |
import org.hamcrest.Description; |
| 5 | |
|
| 6 | |
public class LongAssert extends BaseAssert<Long, LongAssert> { |
| 7 | |
public LongAssert(Long value) { |
| 8 | 0 | super(value); |
| 9 | 0 | } |
| 10 | |
|
| 11 | |
public LongAssert eq(Integer expected) { |
| 12 | 0 | super.eq(expected == null ? null : (long) expected.intValue()); |
| 13 | 0 | return this; |
| 14 | |
} |
| 15 | |
|
| 16 | |
public LongAssert ge(final long value) { |
| 17 | 0 | notNull(); |
| 18 | 0 | matches(new BaseMatcher<Long>() { |
| 19 | |
|
| 20 | |
public boolean matches(Object o) { |
| 21 | 0 | return (Long) o >= value; |
| 22 | |
} |
| 23 | |
|
| 24 | |
public void describeTo(Description description) { |
| 25 | 0 | description.appendText("greater or equal to ").appendValue(value); |
| 26 | 0 | } |
| 27 | |
}); |
| 28 | 0 | return this; |
| 29 | |
} |
| 30 | |
|
| 31 | |
public LongAssert lt(final long value) { |
| 32 | 0 | notNull(); |
| 33 | 0 | matches(new BaseMatcher<Long>() { |
| 34 | |
public boolean matches(Object o) { |
| 35 | 0 | return (Long) o < value; |
| 36 | |
} |
| 37 | |
|
| 38 | |
public void describeTo(Description description) { |
| 39 | 0 | description.appendText("less than ").appendValue(value); |
| 40 | 0 | } |
| 41 | |
}); |
| 42 | 0 | return this; |
| 43 | |
} |
| 44 | |
|
| 45 | |
public LongAssert gt(final long value) { |
| 46 | 0 | notNull(); |
| 47 | 0 | matches(new BaseMatcher<Long>() { |
| 48 | |
public boolean matches(Object o) { |
| 49 | 0 | return (Long) o > value; |
| 50 | |
} |
| 51 | |
|
| 52 | |
public void describeTo(Description description) { |
| 53 | 0 | description.appendText("greater than ").appendValue(value); |
| 54 | 0 | } |
| 55 | |
}); |
| 56 | 0 | return this; |
| 57 | |
} |
| 58 | |
} |