Uploaded image for project: 'Hadoop Common'
  1. Hadoop Common
  2. HADOOP-12693 Many misusages of assertEquals(expected, actual)
  3. HADOOP-16508

[hadoop-yarn-project] Fix order of actual and expected expression in assert statements

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.2.0
    • 3.3.0
    • None
    • None
    • Reviewed

    Description

      Fix order of actual and expected expression in assert statements which gives misleading message when test case fails. Attached file has some of the places where it is placed wrongly.

      [ERROR] testNodeRemovalGracefully(org.apache.hadoop.yarn.server.resourcemanager.TestResourceTrackerService)  Time elapsed: 3.385 s  <<< FAILURE!
      java.lang.AssertionError: Shutdown nodes should be 0 now expected:<1> but was:<0>
      

      For long term, AssertJ can be used for new test cases which avoids such mistakes.

      Attachments

        1. YARN-9470-005.patch
          173 kB
          Prabhu Joseph
        2. YARN-9470-004.patch
          173 kB
          Prabhu Joseph
        3. YARN-9470-003.patch
          173 kB
          Prabhu Joseph
        4. YARN-9470-002.patch
          173 kB
          Prabhu Joseph
        5. YARN-9470-001.patch
          144 kB
          Prabhu Joseph
        6. assertEquals
          65 kB
          Prabhu Joseph

        Issue Links

          Activity

            People

              prabhujoseph Prabhu Joseph
              prabhujoseph Prabhu Joseph
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: