Class UseAnAbility

java.lang.Object
net.serenitybdd.screenplay.UseAnAbility

public class UseAnAbility
extends java.lang.Object
A factory to get an Ability of an Actor, when we don't care what it is specifically, just that it can do what we expect it to. Example Usage: UseAnAbility.of(actor).that(CanLevitate.class).hover()
  • Method Summary

    Modifier and Type Method Description
    static UseAnAbility of​(Actor actor)  
    <C> C that​(java.lang.Class<C> implementedInterface)
    If the actor has an Ability that implements the Interface, return that.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • of

      public static UseAnAbility of​(Actor actor)
    • that

      public <C> C that​(java.lang.Class<C> implementedInterface)
      If the actor has an Ability that implements the Interface, return that. If there are multiple candidate Abilities, the first one found will be returned.
      Type Parameters:
      C - the implementation of the Interface
      Parameters:
      implementedInterface - the Interface class that we expect to find
      Returns:
      the Ability that implements the interface