Commons Lang
  1. Commons Lang
  2. LANG-37

[lang] unit test for org.apache.commons.lang.text.StrBuilder

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.2
    • Component/s: None
    • Labels:
      None
    • Environment:

      Operating System: other
      Platform: Other

      Description

      Gary Gregory wrote:

      I hate to put a damper on things so late in the game but Clover reports
      that we have 0% code coverage for three new 2.1 classes
      (MappedMessageFormat, StrBuilder, StrTokenizer.StringMatcher) in the new
      to 2.1 package:

      http://people.apache.org/~stevencaswell/commons-lang-2.1/docs/clover/org
      /apache/commons/lang/text/pkg-summary.html

      Sadly, this makes the coverage for this new package the lowest % in all
      of [lang].

      Did someone forget to commit unit tests? This surely must be an omission
      of some kind. I cannot see us releasing without unit tests for this new
      code.

      Gary

      Attached is the start of a unit test for StrBuilder. Sorry it is not complete – I ran out of steam.

        Activity

        Hide
        Michael Heuer added a comment -

        Created an attachment (id=14912)
        StrBuilderTest.java

        Show
        Michael Heuer added a comment - Created an attachment (id=14912) StrBuilderTest.java
        Hide
        ggregory@seagullsw.com added a comment -

        Patch applied and tweaked a bit.
        Thank you Michael.
        Clover now reports 46% instead of 0%.

        Show
        ggregory@seagullsw.com added a comment - Patch applied and tweaked a bit. Thank you Michael. Clover now reports 46% instead of 0%.
        Hide
        Michael Heuer added a comment -

        Created an attachment (id=15659)
        svn diff src/

        svn commit r209943 causes two tests to fail for me:


        Testsuite: org.apache.commons.lang.text.TextTestSuite
        Tests run: 65, Failures: 1, Errors: 1, Time elapsed: 2.531 sec

        Testcase:
        testAppendFixedWidthPadLeft(org.apache.commons.lang.text.StrBuilderTest):
        FAILED
        expected:<null> but was:<null>
        junit.framework.ComparisonFailure: expected:<null> but was:<null>
        at
        org.apache.commons.lang.text.StrBuilderTest.testAppendFixedWidthPadLeft(StrBuilderTest.java:571)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
        sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
        sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

        Testcase:
        testAppendWithSeparators_Iterator(org.apache.commons.lang.text.StrBuilderTest):

        Caused an ERROR
        null
        java.util.NoSuchElementException
        at java.util.AbstractList$Itr.next(AbstractList.java:427)
        at
        org.apache.commons.lang.text.StrBuilder.appendWithSeparators(StrBuilder.java:614)

        at
        org.apache.commons.lang.text.StrBuilderTest.testAppendWithSeparators_Iterator(StrBuilderTest.java:727)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
        sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
        sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

        diff attached.

        Show
        Michael Heuer added a comment - Created an attachment (id=15659) svn diff src/ svn commit r209943 causes two tests to fail for me: — Testsuite: org.apache.commons.lang.text.TextTestSuite Tests run: 65, Failures: 1, Errors: 1, Time elapsed: 2.531 sec Testcase: testAppendFixedWidthPadLeft(org.apache.commons.lang.text.StrBuilderTest): FAILED expected:< null> but was:<null > junit.framework.ComparisonFailure: expected:< null> but was:<null > at org.apache.commons.lang.text.StrBuilderTest.testAppendFixedWidthPadLeft(StrBuilderTest.java:571) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) Testcase: testAppendWithSeparators_Iterator(org.apache.commons.lang.text.StrBuilderTest): Caused an ERROR null java.util.NoSuchElementException at java.util.AbstractList$Itr.next(AbstractList.java:427) at org.apache.commons.lang.text.StrBuilder.appendWithSeparators(StrBuilder.java:614) at org.apache.commons.lang.text.StrBuilderTest.testAppendWithSeparators_Iterator(StrBuilderTest.java:727) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) diff attached.
        Hide
        ggregory@seagullsw.com added a comment -

        Patch applied, thank you.

        Show
        ggregory@seagullsw.com added a comment - Patch applied, thank you.
        Hide
        Stephen Colebourne added a comment -

        Further tests can go in a new or reopened call

        Show
        Stephen Colebourne added a comment - Further tests can go in a new or reopened call

          People

          • Assignee:
            Unassigned
            Reporter:
            Michael Heuer
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development