### Question:
DescriptorMatcher extends ElementMatcher.Junction.AbstractBase<T> { public boolean matches(T target) { return matcher.matches(target.getDescriptor()); } DescriptorMatcher(ElementMatcher<String> matcher); boolean matches(T target); @Override String toString();  }### Answer:
@Test public void testMatch() throws Exception { when(descriptorMatcher.matches(FOO)).thenReturn(true); assertThat(new DescriptorMatcher<NamedElement.WithDescriptor>(descriptorMatcher).matches(namedElement), is(true)); verify(descriptorMatcher).matches(FOO); verifyNoMoreInteractions(descriptorMatcher); }
@Test public void testNoMatch() throws Exception { when(descriptorMatcher.matches(FOO)).thenReturn(false); assertThat(new DescriptorMatcher<NamedElement.WithDescriptor>(descriptorMatcher).matches(namedElement), is(false)); verify(descriptorMatcher).matches(FOO); verifyNoMoreInteractions(descriptorMatcher); }