1 package com.lexicalscope.fluentreflection; 2 3 import static com.lexicalscope.fluentreflection.ReflectionMatchers.declaredBy; 4 import static org.hamcrest.Matchers.equalTo; 5 6 import org.hamcrest.Matcher; 7 8 public class TestMatcherElementDeclaredBy extends AbstractTestReflectionMatcher<FluentMember> { 9 interface DeclaringInterface { 10 11 } 12 13 interface NonDeclaringInterface { 14 15 } 16 17 @Override protected FluentMethod target() { 18 return method; 19 } 20 21 @Override protected ReflectionMatcher<FluentMember> matcher() { 22 return declaredBy(DeclaringInterface.class); 23 } 24 25 @Override protected void setupMatchingCase() { 26 whenMethodDeclaredBy(DeclaringInterface.class); 27 } 28 29 @Override protected void setupFailingCase() { 30 whenMethodDeclaredBy(NonDeclaringInterface.class); 31 } 32 33 @Override protected Matcher<String> hasDescription() { 34 return equalTo("callable declared by type <" + DeclaringInterface.class + ">"); 35 } 36 }