Class Actor

java.lang.Object
net.serenitybdd.screenplay.Actor
All Implemented Interfaces:
Agent, SkipNested, PerformsTasks

public class Actor
extends java.lang.Object
implements PerformsTasks, SkipNested, Agent
An actor represents the person or system using the application under test. Actors can have Abilities, which allows them to perform Tasks and Interactions. Actors can ask Questions about the state of the system.
  • Constructor Details

    • Actor

      public Actor​(java.lang.String name)
  • Method Details

    • brief

      public void brief​(Actor otherActor)
      Add all the remembered items for the current actor to the other actor's memory
      Parameters:
      otherActor -
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.lang.Object
    • named

      public static Actor named​(java.lang.String name)
    • describedAs

      public Actor describedAs​(java.lang.String description)
    • getName

      public java.lang.String getName()
      Specified by:
      getName in interface Agent
    • getDescription

      public java.lang.String getDescription()
    • getNameOrPronoun

      public java.lang.String getNameOrPronoun()
    • can

      public <T extends Ability> Actor can​(T doSomething)
    • whoCan

      public <T extends Ability> Actor whoCan​(T doSomething)
    • abilityTo

      public <T extends Ability> T abilityTo​(java.lang.Class<? extends T> doSomething)
    • getAbilityThatExtends

      public <C> C getAbilityThatExtends​(java.lang.Class<C> extendedClass)
      Return an ability that extends the given class. Can be a Superclass or an Interface. If there are multiple candidate Abilities, the first one found will be returned.
      Type Parameters:
      C - the matching Ability cast to extendedClass or null if none match
      Parameters:
      extendedClass - the Interface class that we expect to find
    • getTeardowns

      public java.util.List<HasTeardown> getTeardowns()
      Return a list of all Abilitys which implement HasTeardown
    • usingAbilityTo

      public <T extends Ability> T usingAbilityTo​(java.lang.Class<? extends T> doSomething)
      A more readable way to access an actor's abilities.
    • entersTheScene

      public final void entersTheScene()
      A method used to declare that an actor is now the actor in the spotlight, without having them perform any tasks.
    • has

      public final void has​(Performable... todos)
    • has

      public final void has​(Fact... facts)
    • wasAbleTo

      public final void wasAbleTo​(Performable... todos)
      A tense-neutral synonym for addFact() for use with given() clauses
    • attemptsTo

      public final void attemptsTo​(Performable... tasks)
      Specified by:
      attemptsTo in interface PerformsTasks
    • asksFor

      public <ANSWER> ANSWER asksFor​(Question<ANSWER> question)
      Specified by:
      asksFor in interface PerformsTasks
    • can

      public final void can​(Consequence<?>... consequences)
    • should

      public final void should​(java.lang.String groupStepName, Consequence<?>... consequences)
    • should

      public final void should​(java.util.List<Consequence<?>> consequences)
    • should

      public final void should​(Consequence<?>... consequences)
    • remember

      public <ANSWER> void remember​(java.lang.String key, Question<ANSWER> question)
    • remember

      public void remember​(java.lang.String key, java.lang.Object value)
    • recall

      public <T> T recall​(java.lang.String key)
    • recallAll

      public java.util.Map<java.lang.String,​java.lang.Object> recallAll()
    • forget

      public <T> T forget​(java.lang.String key)
    • sawAsThe

      public <T> T sawAsThe​(java.lang.String key)
    • gaveAsThe

      public <T> T gaveAsThe​(java.lang.String key)
    • usingPronoun

      public Actor usingPronoun​(java.lang.String pronoun)
    • withNoPronoun

      public Actor withNoPronoun()
    • assignDescriptionToActor

      public void assignDescriptionToActor​(java.lang.String description)
    • assignName

      public void assignName​(java.lang.String name)
    • wrapUp

      public void wrapUp()
    • getId

      public java.lang.String getId()
      Specified by:
      getId in interface Agent