private static Object stub(Class klass) {
    if (!klass.isInterface()) {
      throw new IllegalArgumentException("Cannot stub an non-interface");
    }

    return Proxy.newProxyInstance(klass.getClassLoader(), new Class[] {klass}, sInvocationHandler);
  }
Simulates the view as being attached.
core/src/main/java/com/facebook/testing/screenshot/WindowAttachment.java