[MAGNOLIA-6827] Getting a non-existent parameter from a MockWebContext should not cause a NullPointerException Created: 18/Oct/16  Updated: 18/Oct/16

Status: Open
Project: Magnolia
Component/s: testing
Affects Version/s: 5.4.8
Fix Version/s: None

Type: Bug Priority: Neutral
Reporter: Nils Breunese Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled

 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).


Generated at Mon Feb 12 04:18:12 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.