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