### Question:
DeclaringMethodMatcher extends ElementMatcher.Junction.AbstractBase<T> { public boolean matches(T target) { return matcher.matches(target.getDeclaredMethods()); } DeclaringMethodMatcher(ElementMatcher<? super MethodList<? extends MethodDescription>> matcher); boolean matches(T target); @Override String toString();  }### Answer:
@Test @SuppressWarnings("unchecked") public void testMatch() throws Exception { when(typeDescription.getDeclaredMethods()).thenReturn((MethodList) methodList); when(methodMatcher.matches(methodList)).thenReturn(true); assertThat(new DeclaringMethodMatcher<TypeDescription>(methodMatcher).matches(typeDescription), is(true)); verify(methodMatcher).matches(methodList); verifyNoMoreInteractions(methodMatcher); verify(typeDescription).getDeclaredMethods(); verifyNoMoreInteractions(typeDescription); }
@Test @SuppressWarnings("unchecked") public void testNoMatch() throws Exception { when(typeDescription.getDeclaredMethods()).thenReturn((MethodList) methodList); when(methodMatcher.matches(methodList)).thenReturn(false); assertThat(new DeclaringMethodMatcher<TypeDescription>(methodMatcher).matches(typeDescription), is(false)); verify(methodMatcher).matches(methodList); verifyNoMoreInteractions(methodMatcher); verify(typeDescription).getDeclaredMethods(); verifyNoMoreInteractions(typeDescription); }