### Question:
MoreElements implements Elements { public boolean isVirtualDefaultMethod(TypeElement typeElement, ExecutableElement methodElement) { return ElementFilter.typesIn(typeElement.getEnclosedElements()).stream() .filter(t -> t.getSimpleName().contentEquals("DefaultImpls")) .anyMatch( t -> ElementFilter.methodsIn(t.getEnclosedElements()).stream() .filter( m -> { EnumSet<Modifier> set = EnumSet.of(Modifier.PUBLIC, Modifier.STATIC); return m.getModifiers().containsAll(set); }) .filter( m -> { Name name1 = m.getSimpleName(); Name name2 = methodElement.getSimpleName(); return name1.contentEquals(name2); }) .filter( m -> { TypeMirror type1 = m.getReturnType(); TypeMirror type2 = methodElement.getReturnType(); return ctx.getMoreTypes().isSameType(type1, type2); }) .filter( m -> { int size1 = m.getParameters().size(); int size2 = methodElement.getParameters().size() + 1; return size1 == size2; }) .filter( m -> { TypeMirror type1 = m.getParameters().iterator().next().asType(); TypeMirror type2 = typeElement.asType(); return ctx.getMoreTypes().isSameTypeWithErasure(type1, type2); }) .anyMatch( m -> { Stream<? extends VariableElement> parameters1 = m.getParameters().stream().skip(1); Stream<? extends VariableElement> parameters2 = methodElement.getParameters().stream(); return Zip.stream(parameters1, parameters2) .map(pair -> new Pair<>(pair.fst.asType(), pair.snd.asType())) .allMatch(p -> ctx.getMoreTypes().isSameType(p.fst, p.snd)); })); } MoreElements(Context ctx, ProcessingEnvironment env); @Override PackageElement getPackageElement(CharSequence name); @Override TypeElement getTypeElement(CharSequence canonicalName); @Override Map<? extends ExecutableElement, ? extends AnnotationValue> getElementValuesWithDefaults(
      AnnotationMirror a); @Override String getDocComment(Element e); @Override boolean isDeprecated(Element e); @Override Name getBinaryName(TypeElement type); @Override PackageElement getPackageOf(Element type); @Override List<? extends Element> getAllMembers(TypeElement type); @Override List<? extends AnnotationMirror> getAllAnnotationMirrors(Element e); @Override boolean hides(Element hider, Element hidden); @Override boolean overrides(
      ExecutableElement overrider, ExecutableElement overridden, TypeElement type); @Override String getConstantExpression(Object value); @Override void printElements(Writer w, Element... elements); @Override Name getName(CharSequence cs); @Override boolean isFunctionalInterface(TypeElement type); String getParameterName(VariableElement variableElement); TypeElement toTypeElement(Element element); TypeParameterElement toTypeParameterElement(Element element); ExecutableType toExecutableType(Element element); TypeElement getTypeElementFromBinaryName(String binaryName); TypeElement getTypeElement(Class<?> clazz); AnnotationMirror getAnnotationMirror(
      Element element, Class<? extends Annotation> annotationClass); AnnotationMirror getAnnotationMirror(Element element, String annotationClassName); ExecutableElement getNoArgConstructor(TypeElement typeElement); Map<String, AnnotationValue> getValuesWithoutDefaults(AnnotationMirror annotationMirror); Map<String, AnnotationValue> getValuesWithDefaults(AnnotationMirror annotationMirror); TypeParametersDef getTypeParametersDef(Parameterizable element); VariableElement getSingleParameterOfRecordConstructor(TypeElement record); boolean isVirtualDefaultMethod(TypeElement typeElement, ExecutableElement methodElement);  }### Answer:
@Test void isVirtualDefaultMethod() { addProcessor( new TestProcessor() { @Override protected void run() { TypeElement typeElement = ctx.getMoreElements().getTypeElement(MyDao.class); ExecutableElement doIt = createMethodElement(MyDao.class, "doIt"); assertTrue(ctx.getMoreElements().isVirtualDefaultMethod(typeElement, doIt)); ExecutableElement execute = createMethodElement(MyDao.class, "execute", String.class); assertTrue(ctx.getMoreElements().isVirtualDefaultMethod(typeElement, execute)); ExecutableElement run = createMethodElement(MyDao.class, "run", String.class); assertFalse(ctx.getMoreElements().isVirtualDefaultMethod(typeElement, run)); } }); }