1 | 40 | package com.lexicalscope.fluentreflection; |
2 | |
|
3 | |
import org.hamcrest.Description; |
4 | |
|
5 | |
final class MatcherArgumentCount extends ReflectionMatcher<FluentMember> { |
6 | |
private final int expectedArgumentCount; |
7 | |
|
8 | 40 | public MatcherArgumentCount(final int expectedArgumentCount) { |
9 | 40 | this.expectedArgumentCount = expectedArgumentCount; |
10 | 40 | } |
11 | |
|
12 | |
@Override |
13 | |
protected boolean matchesSafely(final FluentMember item) { |
14 | 40 | return item.argCount() == expectedArgumentCount; |
15 | |
} |
16 | |
|
17 | |
@Override |
18 | |
public void describeTo(final Description description) { |
19 | 8 | description.appendText("callable with ").appendValue(expectedArgumentCount).appendText(" arguments"); |
20 | 8 | } |
21 | |
} |