View Javadoc

1   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       public MatcherArgumentCount(final int expectedArgumentCount) {
9           this.expectedArgumentCount = expectedArgumentCount;
10      }
11  
12      @Override
13      protected boolean matchesSafely(final FluentMember item) {
14          return item.argCount() == expectedArgumentCount;
15      }
16  
17      @Override
18      public void describeTo(final Description description) {
19          description.appendText("callable with ").appendValue(expectedArgumentCount).appendText(" arguments");
20      }
21  }