Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-1234

assertArrayEquals problem when multidimensional array

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.0-JSR-4
    • 1.0-JSR-6
    • groovy-jdk
    • None
    • SuSE Linux 8.2, JDK 1.4.2

    Description

      Testcase bellow throws exception

      testArrayEquals(MultiArrayBugTest)junit.framework.AssertionFailedError: expected array:

      {"A", "B"}

      value array:

      {["A", "C"]}

      expected:<2> but was:<1>.

      // ------------------- MultiArrayClass.java -------------------
      public class MultiArrayClass {
      public String[][] createArray()

      { String s[][] = new String[2][2]; s [0][0] = "A"; s [0][1] = "C"; s [1][0] = "C"; s [1][1] = "D"; return s; }

      }

      // ----------------- MultiArrayBugTest.groovy -----------------
      class MultiArrayBugTest extends GroovyTestCase {
      void testArrayEquals()

      { def m = new MultiArrayClass() def r = m.createArray() assertArrayEquals(['A','B'] as String[], r[0] as String[]); assertArrayEquals(['C','D'] as String[], r[1] as String[]); }

      }

      Attachments

        Activity

          People

            blackdrag Jochen Theodorou
            thubalek TomᚠHubálek
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: