Avoid ConstantConditions warnings suppression (plus related polishing)

Issue: SPR-15756
This commit is contained in:
Juergen Hoeller
2018-05-29 21:47:10 +02:00
parent 8c30b8e628
commit 8593fec22c
12 changed files with 78 additions and 92 deletions

View File

@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.mock.web.test.server;
import java.time.Clock;
@@ -22,6 +23,8 @@ import java.util.Map;
import reactor.core.publisher.Mono;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import org.springframework.web.server.WebSession;
import org.springframework.web.server.session.InMemoryWebSessionStore;
@@ -46,13 +49,14 @@ public class MockWebSession implements WebSession {
this(null);
}
@SuppressWarnings("ConstantConditions")
public MockWebSession(Clock clock) {
public MockWebSession(@Nullable Clock clock) {
InMemoryWebSessionStore sessionStore = new InMemoryWebSessionStore();
if (clock != null) {
sessionStore.setClock(clock);
}
this.delegate = sessionStore.createWebSession().block();
WebSession session = sessionStore.createWebSession().block();
Assert.state(session != null, "WebSession must not be null");
this.delegate = session;
}