Properly detect null value params in params conditions
Issue: SPR-15831
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -23,7 +23,11 @@ import org.junit.Test;
|
||||
import org.springframework.mock.web.test.MockHttpServletRequest;
|
||||
import org.springframework.web.servlet.mvc.condition.ParamsRequestCondition.ParamExpression;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link ParamsRequestCondition}.
|
||||
@@ -48,6 +52,14 @@ public class ParamsRequestConditionTests {
|
||||
assertNotNull(new ParamsRequestCondition("foo").getMatchingCondition(request));
|
||||
}
|
||||
|
||||
@Test // SPR-15831
|
||||
public void paramPresentNullValue() {
|
||||
MockHttpServletRequest request = new MockHttpServletRequest();
|
||||
request.addParameter("foo", (String) null);
|
||||
|
||||
assertNotNull(new ParamsRequestCondition("foo").getMatchingCondition(request));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void paramPresentNoMatch() {
|
||||
MockHttpServletRequest request = new MockHttpServletRequest();
|
||||
|
||||
Reference in New Issue
Block a user