### Question:
HasSuperTypeMatcher extends ElementMatcher.Junction.AbstractBase<T> { public boolean matches(T target) { Set<TypeDescription> previous = new HashSet<TypeDescription>(); for (TypeDefinition typeDefinition : target) { if (!previous.add(typeDefinition.asErasure())) { return false; } else if (matcher.matches(typeDefinition.asGenericType())) { return true; } LinkedList<TypeDefinition> interfaceTypes = new LinkedList<TypeDefinition>(typeDefinition.getInterfaces()); while (!interfaceTypes.isEmpty()) { TypeDefinition interfaceType = interfaceTypes.removeFirst(); if (previous.add(interfaceType.asErasure())) { if (matcher.matches(interfaceType.asGenericType())) { return true; } else { interfaceTypes.addAll(interfaceType.getInterfaces()); } } } } return false; } HasSuperTypeMatcher(ElementMatcher<? super TypeDescription.Generic> matcher); boolean matches(T target); @Override String toString();  }### Answer:
@Test public void testMatchSuperClass() throws Exception { when(typeMatcher.matches(superType)).thenReturn(true); assertThat(new HasSuperTypeMatcher<TypeDescription>(typeMatcher).matches(typeDescription), is(true)); }
@Test public void testMatchSuperInterface() throws Exception { when(typeMatcher.matches(interfaceType)).thenReturn(true); assertThat(new HasSuperTypeMatcher<TypeDescription>(typeMatcher).matches(typeDescription), is(true)); }
@Test public void testMatchSuperInterfaceImplicit() throws Exception { when(typeMatcher.matches(implicitInterfaceType)).thenReturn(true); assertThat(new HasSuperTypeMatcher<TypeDescription>(typeMatcher).matches(typeDescription), is(true)); }
@Test public void testNoMatch() throws Exception { assertThat(new HasSuperTypeMatcher<TypeDescription>(typeMatcher).matches(typeDescription), is(false)); }
@Test public void testNoMatchRecursive() throws Exception { when(typeDescription.getSuperClass()).thenReturn(superType); when(superType.getSuperClass()).thenReturn(superType); assertThat(new HasSuperTypeMatcher<TypeDescription>(typeMatcher).matches(typeDescription), is(false)); }