Uploaded image for project: 'Magnolia'
  1. Magnolia
  2. MAGNOLIA-6827

Getting a non-existent parameter from a MockWebContext should not cause a NullPointerException

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Neutral
    • Resolution: Unresolved
    • Affects Version/s: 5.4.8
    • Fix Version/s: None
    • Component/s: testing
    • Labels:
      None

      Description

      Currently this test fails:

      @Test
      public void gettingNonExistentParamaterShouldNotCauseNullPointerException() {
          assertThat(new MockWebContext().getParameter("doesNotExist")).isNull();
      }
      

      The cause seems to be that MockWebContext.java:94 calls getParameters(), which is null until explicitly set. The result of getParameters() should be checked for null before calling a method on it (or be guaranteed to not be null).

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            breun Nils Breunese
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated: