Update ModuleReaderTest to JUnit prior to making changes

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Fixed
    • Priority: P4
    • 27
    • Affects Version/s: None
    • Component/s: core-libs

      ModuleReaderTest is full of "bare" assertions which don't provide context and obfuscate any work to add tests of change behaviour.

      This ranges from:
      ---
          assertTrue(uri.toString().endsWith("/"))
      ---
      which is called for multiple URIs but doesn't report the URI for which that assert fails.

      To:
      ---
          try {
              reader.read(null);
              assertTrue(false);
          } catch (NullPointerException expected) { }
      ---
      which is much more clearly/idiomatically expressed as:
      ---
          assertThrows(NullPointerException.class, () -> reader.read(null));
      ---

      It also uses TestNG, in which expected/actual parameters are reversed from JUnit, which is a cause of potential confusion while debugging.

      Since I am about to add and/or modify some tests in this class (in lworld), it would be useful to first update it to JUnit, use more idiomatic asserts and add better context to assertions where needed.

            Assignee:
            David Beaumont
            Reporter:
            David Beaumont
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: