1   package com.lexicalscope.fluentreflection;
2   
3   import static com.lexicalscope.fluentreflection.ReflectionMatchers.hasArgumentCount;
4   import static org.hamcrest.Matchers.equalTo;
5   
6   import org.hamcrest.Matcher;
7   import org.jmock.Expectations;
8   
9   public class TestMatcherArgumentCount extends AbstractTestReflectionMatcher<FluentMember> {
10      @Override
11      protected ReflectionMatcher<FluentMember> matcher() {
12          return hasArgumentCount(3);
13      }
14  
15      @Override
16      protected Matcher<String> hasDescription() {
17          return equalTo("callable with <3> arguments");
18      }
19  
20      @Override
21      protected void setupFailingCase() {
22          context.checking(new Expectations() {
23              {
24                  oneOf(callable).argCount();
25                  will(returnValue(5));
26              }
27          });
28      }
29  
30      @Override
31      protected void setupMatchingCase() {
32          context.checking(new Expectations() {
33              {
34                  oneOf(callable).argCount();
35                  will(returnValue(3));
36              }
37          });
38      }
39  
40      @Override
41      protected FluentMember target() {
42          return callable;
43      }
44  }