### Question:
MoreElements { public static VariableElement asVariable(Element element) { return element.accept(VariableElementVisitor.INSTANCE, null); } private  MoreElements(); static PackageElement getPackage(Element element); static PackageElement asPackage(Element element); static boolean isType(Element element); static TypeElement asType(Element element); static TypeParameterElement asTypeParameter(Element element); static VariableElement asVariable(Element element); static ExecutableElement asExecutable(Element element); static boolean isAnnotationPresent(Element element,
      Class<? extends Annotation> annotationClass); static Optional<AnnotationMirror> getAnnotationMirror(Element element,
      Class<? extends Annotation> annotationClass); static Predicate<T> hasModifiers(Modifier... modifiers); static Predicate<T> hasModifiers(final Set<Modifier> modifiers); @Deprecated static ImmutableSet<ExecutableElement> getLocalAndInheritedMethods(
      TypeElement type, Elements elementUtils); static ImmutableSet<ExecutableElement> getLocalAndInheritedMethods(
      TypeElement type, Types typeUtils, Elements elementUtils); static boolean overrides(
      ExecutableElement overrider,
      ExecutableElement overridden,
      TypeElement type,
      Types typeUtils); static ImmutableSet<ExecutableElement> getAllMethods(
      TypeElement type, Types typeUtils, Elements elementUtils);  }### Answer:
@Test public void asVariable() { for (Element variableElement : ElementFilter.fieldsIn(stringElement.getEnclosedElements())) { assertThat(MoreElements.asVariable(variableElement)).isEqualTo(variableElement); } }
@Test public void asVariable_illegalArgument() { try { MoreElements.asVariable(javaLangPackageElement); fail(); } catch (IllegalArgumentException expected) {} }