Uploaded image for project: 'OpenMRS Core'
  1. OpenMRS Core
  2. TRUNK-2063

Fix fragile date comparison in ShortPatientFormValidatorTest

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Should
    • Resolution: Fixed
    • Affects Version/s: OpenMRS 1.8.0
    • Fix Version/s: OpenMRS 1.8.0, OpenMRS 1.9.0
    • Component/s: None
    • Labels:
      None
    • Complexity:
      Low

      Description

      Both the ShortPatientFormValidator and ShortPatientFormValidatorTest create a Calendar and subtract 120 years from the current date
      The ShortPatientFormValidator compares these two dates, expecting the test created date to be earlier.
      Occasionally these date values are the same and the test fails (I found it failing in 1 out of 4 runs)

      Failed tests:
      validate_shouldFailValidationIfBirthdateMakesPatient120YearsOldOrOlder(org.openmrs.web.controller.patient.ShortPatientFormValidatorTest)

      java.lang.AssertionError: expected:<true> but was:<false>
      org.openmrs.web.controller.patient.ShortPatientFormValidatorTest.validate_shouldFailValidationIfBirthdateMakesPatient120YearsOldOrOlder(ShortPatientFormValidatorTest.java:236)

        Gliffy Diagrams

          Attachments

            Attachments-Category-Modification

              Activity

                People

                • Assignee:
                  mblanchette Matthew Blanchette
                  Reporter:
                  mblanchette Matthew Blanchette
                  Watchers:
                  Ben Wolfe, Matthew Blanchette
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  2 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: