Skip to content

Commit 5b6a32d

Browse files
committed
Polishing
1 parent 263244f commit 5b6a32d

File tree

3 files changed

+23
-24
lines changed

3 files changed

+23
-24
lines changed

spring-beans/src/main/java/org/springframework/beans/factory/xml/ParserContext.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2018 the original author or authors.
2+
* Copyright 2002-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -64,24 +64,24 @@ public ParserContext(XmlReaderContext readerContext, BeanDefinitionParserDelegat
6464
}
6565

6666

67-
public final XmlReaderContext getReaderContext() {
67+
public XmlReaderContext getReaderContext() {
6868
return this.readerContext;
6969
}
7070

71-
public final BeanDefinitionRegistry getRegistry() {
71+
public BeanDefinitionRegistry getRegistry() {
7272
return this.readerContext.getRegistry();
7373
}
7474

75-
public final BeanDefinitionParserDelegate getDelegate() {
75+
public BeanDefinitionParserDelegate getDelegate() {
7676
return this.delegate;
7777
}
7878

7979
@Nullable
80-
public final BeanDefinition getContainingBeanDefinition() {
80+
public BeanDefinition getContainingBeanDefinition() {
8181
return this.containingBeanDefinition;
8282
}
8383

84-
public final boolean isNested() {
84+
public boolean isNested() {
8585
return (this.containingBeanDefinition != null);
8686
}
8787

spring-webmvc/src/test/java/org/springframework/web/servlet/config/annotation/ResourceHandlerRegistryTests.java

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -65,7 +65,7 @@ public class ResourceHandlerRegistryTests {
6565

6666

6767
@BeforeEach
68-
public void setUp() {
68+
public void setup() {
6969
GenericWebApplicationContext appContext = new GenericWebApplicationContext();
7070
appContext.refresh();
7171

@@ -77,8 +77,14 @@ public void setUp() {
7777
this.response = new MockHttpServletResponse();
7878
}
7979

80+
private ResourceHttpRequestHandler getHandler(String pathPattern) {
81+
SimpleUrlHandlerMapping hm = (SimpleUrlHandlerMapping) this.registry.getHandlerMapping();
82+
return (ResourceHttpRequestHandler) hm.getUrlMap().get(pathPattern);
83+
}
84+
85+
8086
@Test
81-
public void noResourceHandlers() throws Exception {
87+
public void noResourceHandlers() {
8288
this.registry = new ResourceHandlerRegistry(new GenericWebApplicationContext(), new MockServletContext());
8389
assertThat((Object) this.registry.getHandlerMapping()).isNull();
8490
}
@@ -127,7 +133,7 @@ public void hasMappingForPattern() {
127133
}
128134

129135
@Test
130-
public void resourceChain() throws Exception {
136+
public void resourceChain() {
131137
ResourceResolver mockResolver = Mockito.mock(ResourceResolver.class);
132138
ResourceTransformer mockTransformer = Mockito.mock(ResourceTransformer.class);
133139
this.registration.resourceChain(true).addResolver(mockResolver).addTransformer(mockTransformer);
@@ -149,7 +155,7 @@ public void resourceChain() throws Exception {
149155
}
150156

151157
@Test
152-
public void resourceChainWithoutCaching() throws Exception {
158+
public void resourceChainWithoutCaching() {
153159
this.registration.resourceChain(false);
154160

155161
ResourceHttpRequestHandler handler = getHandler("/resources/**");
@@ -163,7 +169,7 @@ public void resourceChainWithoutCaching() throws Exception {
163169
}
164170

165171
@Test
166-
public void resourceChainWithVersionResolver() throws Exception {
172+
public void resourceChainWithVersionResolver() {
167173
VersionResourceResolver versionResolver = new VersionResourceResolver()
168174
.addFixedVersionStrategy("fixed", "/**/*.js")
169175
.addContentVersionStrategy("/**");
@@ -187,7 +193,7 @@ public void resourceChainWithVersionResolver() throws Exception {
187193
}
188194

189195
@Test
190-
public void resourceChainWithOverrides() throws Exception {
196+
public void resourceChainWithOverrides() {
191197
CachingResourceResolver cachingResolver = Mockito.mock(CachingResourceResolver.class);
192198
VersionResourceResolver versionResolver = Mockito.mock(VersionResourceResolver.class);
193199
WebJarsResourceResolver webjarsResolver = Mockito.mock(WebJarsResourceResolver.class);
@@ -222,7 +228,7 @@ public void resourceChainWithOverrides() throws Exception {
222228
}
223229

224230
@Test
225-
public void urlResourceWithCharset() throws Exception {
231+
public void urlResourceWithCharset() {
226232
this.registration.addResourceLocations("[charset=ISO-8859-1]file:///tmp");
227233
this.registration.resourceChain(true);
228234

@@ -238,9 +244,4 @@ public void urlResourceWithCharset() throws Exception {
238244
assertThat(locationCharsets.values().iterator().next()).isEqualTo(StandardCharsets.ISO_8859_1);
239245
}
240246

241-
private ResourceHttpRequestHandler getHandler(String pathPattern) {
242-
SimpleUrlHandlerMapping hm = (SimpleUrlHandlerMapping) this.registry.getHandlerMapping();
243-
return (ResourceHttpRequestHandler) hm.getUrlMap().get(pathPattern);
244-
}
245-
246247
}

spring-webmvc/src/test/java/org/springframework/web/servlet/resource/ResourceHttpRequestHandlerTests.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2020 the original author or authors.
2+
* Copyright 2002-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -286,7 +286,6 @@ public void getMediaTypeWithFavorPathExtensionOff() throws Exception {
286286

287287
@Test // SPR-14368
288288
public void getResourceWithMediaTypeResolvedThroughServletContext() throws Exception {
289-
290289
MockServletContext servletContext = new MockServletContext() {
291290
@Override
292291
public String getMimeType(String filePath) {
@@ -310,7 +309,6 @@ public String getMimeType(String filePath) {
310309

311310
@Test
312311
public void testInvalidPath() throws Exception {
313-
314312
// Use mock ResourceResolver: i.e. we're only testing upfront validations...
315313

316314
Resource resource = mock(Resource.class);
@@ -656,7 +654,7 @@ public void partialContentMultipleByteRanges() throws Exception {
656654
assertThat(ranges[11]).isEqualTo("t.");
657655
}
658656

659-
@Test // gh-25976
657+
@Test // gh-25976
660658
public void partialContentByteRangeWithEncodedResource(GzipSupport.GzippedFiles gzippedFiles) throws Exception {
661659
String path = "js/foo.js";
662660
gzippedFiles.create(path);
@@ -685,7 +683,7 @@ public void partialContentByteRangeWithEncodedResource(GzipSupport.GzippedFiles
685683
assertThat(this.response.getHeaderValues("Vary")).containsExactly("Accept-Encoding");
686684
}
687685

688-
@Test // gh-25976
686+
@Test // gh-25976
689687
public void partialContentWithHttpHead() throws Exception {
690688
this.request.setMethod("HEAD");
691689
this.request.addHeader("Range", "bytes=0-1");

0 commit comments

Comments
 (0)