The captain of an Aer Lingus flight from Ireland to the US turned the plane around after they were told a male passenger sexually assaulted a teenager mid-flight, a court has heard.