JBehave
  1. JBehave
  2. JBEHAVE-854

Incorrect formatting in JBehave report if fixture uses both string and table parameters

    Details

    • Type: Bug Bug
    • Status: Open Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Number of attachments :
      1

      Description

      fixture code:

          @Then("keyword <variable1> keyword <table1>")
          @Alias("keyword $variable1 keyword $table1")
          public void checkSomething(String variable1, ExamplesTable table1) throws SQLException {
      
      

      usage:
      And keywords variable1 is in

      field value
      IS_VALID Y
      IS_VALID N

        Activity

        Hide
        Ghislain Nadeau added a comment -

        I'ld suggest this fix:

        StepCreator.java:

        private String replaceParameterValue(String stepText, Type type, String value) {
        if (value != null) {
        if (this.isTable(type))

        { stepText = stepText.replace(value, PARAMETER_TABLE_START + value + PARAMETER_TABLE_END); }

        else {
        // only mark non-empty string as parameter (JBEHAVE-656)
        if (value.trim().length() != 0)

        { stepText = stepText.replace(value, PARAMETER_VALUE_START + value + PARAMETER_VALUE_END); }

        //THIS LINE, Change replace() by replaceFirst()
        stepText = stepText.replaceFirst("\n", PARAMETER_VALUE_NEWLINE);
        }
        }
        return stepText;
        }

        Show
        Ghislain Nadeau added a comment - I'ld suggest this fix: StepCreator.java: private String replaceParameterValue(String stepText, Type type, String value) { if (value != null) { if (this.isTable(type)) { stepText = stepText.replace(value, PARAMETER_TABLE_START + value + PARAMETER_TABLE_END); } else { // only mark non-empty string as parameter ( JBEHAVE-656 ) if (value.trim().length() != 0) { stepText = stepText.replace(value, PARAMETER_VALUE_START + value + PARAMETER_VALUE_END); } //THIS LINE, Change replace() by replaceFirst() stepText = stepText.replaceFirst("\n", PARAMETER_VALUE_NEWLINE); } } return stepText; }
        Hide
        Bence Olah added a comment -
        Show
        Bence Olah added a comment - Duplicate of http://jira.codehaus.org/browse/JBEHAVE-1018

          People

          • Assignee:
            Unassigned
            Reporter:
            alexey ieshin
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated: