Package net.serenitybdd.screenplay
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.
-
Field Summary
Fields inherited from interface net.serenitybdd.core.parallel.Agent
IN_THE_CURRENT_SESSION
-
Constructor Summary
Constructors Constructor Description Actor(java.lang.String name)
-
Method Summary
Modifier and Type Method Description <T extends Ability>
TabilityTo(java.lang.Class<? extends T> doSomething)
<ANSWER> ANSWER
asksFor(Question<ANSWER> question)
void
assignDescriptionToActor(java.lang.String description)
void
assignName(java.lang.String name)
void
attemptsTo(Performable... tasks)
void
brief(Actor otherActor)
Add all the remembered items for the current actor to the other actor's memoryvoid
can(Consequence<?>... consequences)
<T extends Ability>
Actorcan(T doSomething)
Actor
describedAs(java.lang.String description)
void
entersTheScene()
A method used to declare that an actor is now the actor in the spotlight, without having them perform any tasks.<T> T
forget(java.lang.String key)
<T> T
gaveAsThe(java.lang.String key)
<C> C
getAbilityThatExtends(java.lang.Class<C> extendedClass)
Return an ability that extends the given class.java.lang.String
getDescription()
java.lang.String
getId()
java.lang.String
getName()
java.lang.String
getNameOrPronoun()
java.util.List<HasTeardown>
getTeardowns()
Return a list of allAbility
s which implementHasTeardown
void
has(Fact... facts)
void
has(Performable... todos)
static Actor
named(java.lang.String name)
<T> T
recall(java.lang.String key)
java.util.Map<java.lang.String,java.lang.Object>
recallAll()
void
remember(java.lang.String key, java.lang.Object value)
<ANSWER> void
remember(java.lang.String key, Question<ANSWER> question)
<T> T
sawAsThe(java.lang.String key)
void
should(java.lang.String groupStepName, Consequence<?>... consequences)
void
should(java.util.List<Consequence<?>> consequences)
void
should(Consequence<?>... consequences)
java.lang.String
toString()
<T extends Ability>
TusingAbilityTo(java.lang.Class<? extends T> doSomething)
A more readable way to access an actor's abilities.Actor
usingPronoun(java.lang.String pronoun)
void
wasAbleTo(Performable... todos)
A tense-neutral synonym for addFact() for use with given() clauses<T extends Ability>
ActorwhoCan(T doSomething)
Actor
withNoPronoun()
void
wrapUp()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Constructor Details
-
Actor
public Actor(java.lang.String name)
-
-
Method Details
-
brief
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 classjava.lang.Object
-
named
-
describedAs
-
getName
public java.lang.String getName() -
getDescription
public java.lang.String getDescription() -
getNameOrPronoun
public java.lang.String getNameOrPronoun() -
can
-
whoCan
-
abilityTo
-
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
Return a list of allAbility
s which implementHasTeardown
-
usingAbilityTo
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
-
has
-
wasAbleTo
A tense-neutral synonym for addFact() for use with given() clauses -
attemptsTo
- Specified by:
attemptsTo
in interfacePerformsTasks
-
asksFor
- Specified by:
asksFor
in interfacePerformsTasks
-
can
-
should
-
should
-
should
-
remember
-
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
-
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()
-