/** Attempts to find {@link DartElement} at the <code>offset</code> position. */
 @SuppressWarnings("unchecked")
 protected static <T extends DartElement> T findElement(CompilationUnit unit, int offset)
     throws Exception {
   DartElement[] elements = unit.codeSelect(offset, 0);
   assertThat(elements).hasSize(1);
   return (T) elements[0];
 }