Class StoryInteraction


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

    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.

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

    Copyright (c) 2022 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

      • StoryInteraction

        public StoryInteraction()
    • Method Detail

      • rememberFromScenarioInteraction

        public void rememberFromScenarioInteraction​(String key)
        Store some data from scenario interaction to the story interaction context for later use.
      • rememberObjectFromScenarioInteraction

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

        public void setScenarioInteraction​(ScenarioInteraction scenarioInteraction)
      • 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)