JBehave
  1. JBehave
  2. JBEHAVE-1075

Add FluentEnumConverter, able to convert lower-cased, space-separated values to Enums

    Details

    • Type: New Feature New Feature
    • Status: Resolved Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.10
    • Component/s: Core
    • Labels:
      None
    • Testcase included:
      yes
    • Patch Submitted:
      Yes
    • Number of attachments :
      0

      Description

      Copying&pasting from the javadoc:

      An EnumConverter allowing stories prose to be more natural. Before performing the actual conversion, it transforms values to upper-case, with any non-alphanumeric character replaced by an underscore ('_').

      Example: assuming we have defined the step "Given I am on the $page" which is mapped to the method iAmOnPage(PageEnum page), we can then write in a scenario:

      Given I am on the login page

      instead of:

      Given I am on the LOGIN_PAGE

      Warning. This requires enum constants to follow the standard conventions for constant names, i.e. all uppercase letters, with words separated by underscores.

        Activity

        Hide
        Mauro Talevi added a comment -

        I think FluentEnumConverter would be a more suitable name.

        Show
        Mauro Talevi added a comment - I think FluentEnumConverter would be a more suitable name.
        Hide
        Alberto Scotto added a comment -

        Nice, agreed.
        Thanks

        Show
        Alberto Scotto added a comment - Nice, agreed. Thanks
        Show
        Alberto Scotto added a comment - https://github.com/jbehave/jbehave-core/pull/77/
        Alberto Scotto made changes -
        Field Original Value New Value
        Summary Add FlexibleEnumConverter, able to convert lower-cased, space-separated values to Enums Add FluentEnumConverter, able to convert lower-cased, space-separated values to Enums
        Hide
        Mauro Talevi added a comment -

        Pulled with thanks

        Show
        Mauro Talevi added a comment - Pulled with thanks
        Mauro Talevi made changes -
        Resolution Fixed [ 1 ]
        Fix Version/s 3.10 [ 20672 ]
        Status Open [ 1 ] Resolved [ 5 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Alberto Scotto
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: