Uploaded image for project: '[Read Only] - Hippo Repository'
  1. [Read Only] - Hippo Repository
  2. REPO-1374

change RepositoryTestCase#setUp to final public void setup()

    XMLWordPrintable

Details

    • Improvement
    • Status: Closed
    • Normal
    • Resolution: Outdated
    • None
    • None
    • None

    Description

      In quite a lot of unit tests you see the following pattern:

          @Before
          public void setUp() throws Exception {
              super.setUp();
              ...
      

      The order in which @Before method are called is defined such that @Before in base classes is called before sub classes, see also this StackOverflow discussion (link).

      A best practice that I'd like to introduce is to use final public void ... for @Before methods so sub classes don't accidentally hide an @Before of a base class.

      Attachments

        Activity

          People

            Unassigned Unassigned
            oscholten Oscar Scholten (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: