|
18 | 18 |
|
19 | 19 | import java.util.ArrayList;
|
20 | 20 | import java.util.Collections;
|
21 |
| -import java.util.Enumeration; |
22 | 21 | import java.util.HashMap;
|
23 | 22 | import java.util.List;
|
24 | 23 | import java.util.Map;
|
25 |
| -import java.util.NoSuchElementException; |
26 | 24 |
|
27 | 25 | import javax.servlet.Filter;
|
28 | 26 | import javax.servlet.FilterRegistration;
|
@@ -93,7 +91,7 @@ private void initialize() {
|
93 | 91 | given(this.servletContext.getInitParameter(anyString())).willAnswer(
|
94 | 92 | (invocation) -> initParameters.get(invocation.getArgument(0)));
|
95 | 93 | given(this.servletContext.getAttributeNames())
|
96 |
| - .willReturn(MockServletWebServer.emptyEnumeration()); |
| 94 | + .willReturn(Collections.emptyEnumeration()); |
97 | 95 | given(this.servletContext.getNamedDispatcher("default"))
|
98 | 96 | .willReturn(mock(RequestDispatcher.class));
|
99 | 97 | for (Initializer initializer : this.initializers) {
|
@@ -142,27 +140,6 @@ public int getPort() {
|
142 | 140 | return this.port;
|
143 | 141 | }
|
144 | 142 |
|
145 |
| - @SuppressWarnings("unchecked") |
146 |
| - public static <T> Enumeration<T> emptyEnumeration() { |
147 |
| - return (Enumeration<T>) EmptyEnumeration.EMPTY_ENUMERATION; |
148 |
| - } |
149 |
| - |
150 |
| - private static class EmptyEnumeration<E> implements Enumeration<E> { |
151 |
| - |
152 |
| - static final MockServletWebServer.EmptyEnumeration<Object> EMPTY_ENUMERATION = new MockServletWebServer.EmptyEnumeration<>(); |
153 |
| - |
154 |
| - @Override |
155 |
| - public boolean hasMoreElements() { |
156 |
| - return false; |
157 |
| - } |
158 |
| - |
159 |
| - @Override |
160 |
| - public E nextElement() { |
161 |
| - throw new NoSuchElementException(); |
162 |
| - } |
163 |
| - |
164 |
| - } |
165 |
| - |
166 | 143 | /**
|
167 | 144 | * A registered servlet.
|
168 | 145 | */
|
|
0 commit comments