Class ScenarioInteraction


  • @Component
    public class ScenarioInteraction
    extends FlatInteraction
    Holds context variables that are needed in the entire JBehave Scenario.

    An Interaction is a spring bean which keeps ThreadLocal state information of a single specification execution available across different steps. The Interaction is setup and torn down before and after every specification execution.

    After a first implementation of scenario interaction by Sven Schomaker, working for Deutsche Telekom AG in 2013.

    Author:
    Daniel Keiss <daniel.keiss@telekom.de>

    Copyright (c) 2021 Daniel Keiss, Deutsche Telekom IT GmbH This file is distributed under the conditions of the Apache License, Version 2.0. For details see the file license on the toplevel.

    • Constructor Detail

      • ScenarioInteraction

        public ScenarioInteraction()
    • Method Detail

      • rememberFromStoryInteraction

        public void rememberFromStoryInteraction​(String key)
        Store some data from story interaction to the scenario interaction context
      • rememberObjectFromStoryInteraction

        public void rememberObjectFromStoryInteraction​(String entityKey,
                                                       String objectKey)
        Store an object from story interaction for an specific entity in the scenario interaction context. Recall this object with recallObject().
      • setStoryInteraction

        public void setStoryInteraction​(StoryInteraction storyInteraction)
      • remember

        public default void remember​(Enum key,
                                     Object value)
        Store some data in the interaction context for later use. Use enum as key.
      • recall

        public default <S> S recall​(Enum key)
        Get some data in the interaction context. Use enum as key.
      • recallNotNull

        public default <S> S recallNotNull​(String key)
      • recallNotNull

        public default <S> S recallNotNull​(Enum key)
      • rememberObject

        public default void rememberObject​(String entityKey,
                                           String objectKey,
                                           Object value)
      • rememberObject

        public default void rememberObject​(Enum entityKey,
                                           String objectKey,
                                           Object value)
      • rememberObject

        public default void rememberObject​(String entityKey,
                                           Map<String,​Object> object)
      • rememberObject

        public default void rememberObject​(Enum entityKey,
                                           Map<String,​Object> object)
      • recallObject

        public default <S> S recallObject​(String objectKey,
                                          String attributeKey)
      • recallObjectNotNull

        public default <S> S recallObjectNotNull​(String objectKey,
                                                 String attributeKey)
      • recallObject

        public default <S> S recallObject​(Enum objectKey,
                                          String attributeKey)
      • recallObjectNotNull

        public default <S> S recallObjectNotNull​(Enum objectKey,
                                                 String attributeKey)
      • recallMap

        public default <S> Map<String,​S> recallMap​(String key)
      • recallMap

        public default <S> Map<String,​S> recallMap​(Enum key)
      • recallMapOrCreateNew

        public default <S> Map<String,​S> recallMapOrCreateNew​(String key)
      • recallMapOrCreateNew

        public default <S> Map<String,​S> recallMapOrCreateNew​(Enum key)
      • rememberToList

        public default <S> void rememberToList​(String key,
                                               S value)
      • rememberToList

        public default <S> void rememberToList​(Enum key,
                                               S value)
      • recallList

        public default <S> List<S> recallList​(String key)
      • recallList

        public default <S> List<S> recallList​(Enum key)
      • recallListOrCreateNew

        public default <S> List<S> recallListOrCreateNew​(String key)
      • recallListOrCreateNew

        public default <S> List<S> recallListOrCreateNew​(Enum key)
      • clear

        public default void clear​(String key)
      • clear

        public default void clear​(Enum key)