Update major/minor version properties in MockServletContext

ServletContext has sets of major/minor version properties that we have
not updated in MockServletContext in several years.

Since we upgraded the baseline to Servlet 6.0 in Spring Framework 6.0,
now seems like a good time to update those version properties.

Closes gh-30395
This commit is contained in:
Sam Brannen 2023-04-28 15:43:29 +02:00
parent cefb734763
commit aabd685225
3 changed files with 14 additions and 14 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2023 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.
@ -111,13 +111,13 @@ public class MockServletContext implements ServletContext {
private final Map<String, ServletContext> contexts = new HashMap<>();
private int majorVersion = 3;
private int majorVersion = 6;
private int minorVersion = 1;
private int minorVersion = 0;
private int effectiveMajorVersion = 3;
private int effectiveMajorVersion = 6;
private int effectiveMinorVersion = 1;
private int effectiveMinorVersion = 0;
private final Map<String, RequestDispatcher> namedRequestDispatchers = new HashMap<>();

View File

@ -105,10 +105,10 @@ class MockServletContextTests {
@Test
void servletVersion() {
assertThat(servletContext.getMajorVersion()).isEqualTo(3);
assertThat(servletContext.getMinorVersion()).isEqualTo(1);
assertThat(servletContext.getEffectiveMajorVersion()).isEqualTo(3);
assertThat(servletContext.getEffectiveMinorVersion()).isEqualTo(1);
assertThat(servletContext.getMajorVersion()).isEqualTo(6);
assertThat(servletContext.getMinorVersion()).isEqualTo(0);
assertThat(servletContext.getEffectiveMajorVersion()).isEqualTo(6);
assertThat(servletContext.getEffectiveMinorVersion()).isEqualTo(0);
servletContext.setMajorVersion(4);
servletContext.setMinorVersion(0);

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2023 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.
@ -111,13 +111,13 @@ public class MockServletContext implements ServletContext {
private final Map<String, ServletContext> contexts = new HashMap<>();
private int majorVersion = 3;
private int majorVersion = 6;
private int minorVersion = 1;
private int minorVersion = 0;
private int effectiveMajorVersion = 3;
private int effectiveMajorVersion = 6;
private int effectiveMinorVersion = 1;
private int effectiveMinorVersion = 0;
private final Map<String, RequestDispatcher> namedRequestDispatchers = new HashMap<>();