Skip to content

Commit 1b728fb

Browse files
committed
Polishing
1 parent 0c52699 commit 1b728fb

File tree

3 files changed

+34
-33
lines changed

3 files changed

+34
-33
lines changed

spring-context-support/src/test/java/org/springframework/validation/beanvalidation2/ValidatorFactoryTests.java

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 the original author or authors.
2+
* Copyright 2002-2018 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.
@@ -61,7 +61,7 @@
6161
public class ValidatorFactoryTests {
6262

6363
@Test
64-
public void testSimpleValidation() throws Exception {
64+
public void testSimpleValidation() {
6565
LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean();
6666
validator.afterPropertiesSet();
6767

@@ -87,7 +87,7 @@ public void testSimpleValidation() throws Exception {
8787
}
8888

8989
@Test
90-
public void testSimpleValidationWithCustomProvider() throws Exception {
90+
public void testSimpleValidationWithCustomProvider() {
9191
LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean();
9292
validator.setProviderClass(HibernateValidator.class);
9393
validator.afterPropertiesSet();
@@ -114,9 +114,10 @@ public void testSimpleValidationWithCustomProvider() throws Exception {
114114
}
115115

116116
@Test
117-
public void testSimpleValidationWithClassLevel() throws Exception {
117+
public void testSimpleValidationWithClassLevel() {
118118
LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean();
119119
validator.afterPropertiesSet();
120+
120121
ValidPerson person = new ValidPerson();
121122
person.setName("Juergen");
122123
person.getAddress().setStreet("Juergen's Street");
@@ -129,7 +130,7 @@ public void testSimpleValidationWithClassLevel() throws Exception {
129130
}
130131

131132
@Test
132-
public void testSpringValidationFieldType() throws Exception {
133+
public void testSpringValidationFieldType() {
133134
LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean();
134135
validator.afterPropertiesSet();
135136

@@ -144,7 +145,7 @@ public void testSpringValidationFieldType() throws Exception {
144145
}
145146

146147
@Test
147-
public void testSpringValidation() throws Exception {
148+
public void testSpringValidation() {
148149
LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean();
149150
validator.afterPropertiesSet();
150151

@@ -172,7 +173,7 @@ public void testSpringValidation() throws Exception {
172173
}
173174

174175
@Test
175-
public void testSpringValidationWithClassLevel() throws Exception {
176+
public void testSpringValidationWithClassLevel() {
176177
LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean();
177178
validator.afterPropertiesSet();
178179

@@ -190,7 +191,7 @@ public void testSpringValidationWithClassLevel() throws Exception {
190191
}
191192

192193
@Test
193-
public void testSpringValidationWithAutowiredValidator() throws Exception {
194+
public void testSpringValidationWithAutowiredValidator() {
194195
ConfigurableApplicationContext ctx = new AnnotationConfigApplicationContext(
195196
LocalValidatorFactoryBean.class);
196197
LocalValidatorFactoryBean validator = ctx.getBean(LocalValidatorFactoryBean.class);
@@ -211,7 +212,7 @@ public void testSpringValidationWithAutowiredValidator() throws Exception {
211212
}
212213

213214
@Test
214-
public void testSpringValidationWithErrorInListElement() throws Exception {
215+
public void testSpringValidationWithErrorInListElement() {
215216
LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean();
216217
validator.afterPropertiesSet();
217218

@@ -229,7 +230,7 @@ public void testSpringValidationWithErrorInListElement() throws Exception {
229230
}
230231

231232
@Test
232-
public void testSpringValidationWithErrorInSetElement() throws Exception {
233+
public void testSpringValidationWithErrorInSetElement() {
233234
LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean();
234235
validator.afterPropertiesSet();
235236

@@ -247,7 +248,7 @@ public void testSpringValidationWithErrorInSetElement() throws Exception {
247248
}
248249

249250
@Test
250-
public void testInnerBeanValidation() throws Exception {
251+
public void testInnerBeanValidation() {
251252
LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean();
252253
validator.afterPropertiesSet();
253254

@@ -259,7 +260,7 @@ public void testInnerBeanValidation() throws Exception {
259260
}
260261

261262
@Test
262-
public void testValidationWithOptionalField() throws Exception {
263+
public void testValidationWithOptionalField() {
263264
LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean();
264265
validator.afterPropertiesSet();
265266

@@ -271,7 +272,7 @@ public void testValidationWithOptionalField() throws Exception {
271272
}
272273

273274
@Test
274-
public void testListValidation() throws Exception {
275+
public void testListValidation() {
275276
LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean();
276277
validator.afterPropertiesSet();
277278

spring-context/src/test/java/org/springframework/context/annotation/configuration/DuplicatePostProcessingTests.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
import org.junit.Test;
2020

21-
import org.springframework.beans.BeansException;
2221
import org.springframework.beans.factory.BeanFactory;
2322
import org.springframework.beans.factory.BeanFactoryAware;
2423
import org.springframework.beans.factory.FactoryBean;
@@ -67,7 +66,7 @@ static class ExampleFactoryBean implements FactoryBean<ExampleBean> {
6766
private final ExampleBean exampleBean = new ExampleBean();
6867

6968
@Override
70-
public ExampleBean getObject() throws Exception {
69+
public ExampleBean getObject() {
7170
return this.exampleBean;
7271
}
7372

@@ -87,27 +86,27 @@ static class ExampleBeanPostProcessor implements BeanPostProcessor, ApplicationC
8786

8887
private ApplicationContext applicationContext;
8988

90-
9189
@Override
92-
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
90+
public Object postProcessBeforeInitialization(Object bean, String beanName) {
9391
return bean;
9492
}
9593

9694
@Override
97-
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
95+
public Object postProcessAfterInitialization(Object bean, String beanName) {
9896
if (bean instanceof ExampleBean) {
9997
this.applicationContext.publishEvent(new ExampleApplicationEvent(this));
10098
}
10199
return bean;
102100
}
103101

104102
@Override
105-
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
103+
public void setApplicationContext(ApplicationContext applicationContext) {
106104
this.applicationContext = applicationContext;
107105
}
108106
}
109107

110108

109+
@SuppressWarnings("serial")
111110
static class ExampleApplicationEvent extends ApplicationEvent {
112111

113112
public ExampleApplicationEvent(Object source) {
@@ -126,7 +125,7 @@ public void onApplicationEvent(ExampleApplicationEvent event) {
126125
}
127126

128127
@Override
129-
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
128+
public void setBeanFactory(BeanFactory beanFactory) {
130129
this.beanFactory = beanFactory;
131130
}
132131
}

spring-context/src/test/java/org/springframework/validation/beanvalidation/ValidatorFactoryTests.java

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 the original author or authors.
2+
* Copyright 2002-2018 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.
@@ -60,7 +60,7 @@
6060
public class ValidatorFactoryTests {
6161

6262
@Test
63-
public void testSimpleValidation() throws Exception {
63+
public void testSimpleValidation() {
6464
LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean();
6565
validator.afterPropertiesSet();
6666

@@ -86,7 +86,7 @@ public void testSimpleValidation() throws Exception {
8686
}
8787

8888
@Test
89-
public void testSimpleValidationWithCustomProvider() throws Exception {
89+
public void testSimpleValidationWithCustomProvider() {
9090
LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean();
9191
validator.setProviderClass(HibernateValidator.class);
9292
validator.afterPropertiesSet();
@@ -113,9 +113,10 @@ public void testSimpleValidationWithCustomProvider() throws Exception {
113113
}
114114

115115
@Test
116-
public void testSimpleValidationWithClassLevel() throws Exception {
116+
public void testSimpleValidationWithClassLevel() {
117117
LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean();
118118
validator.afterPropertiesSet();
119+
119120
ValidPerson person = new ValidPerson();
120121
person.setName("Juergen");
121122
person.getAddress().setStreet("Juergen's Street");
@@ -128,7 +129,7 @@ public void testSimpleValidationWithClassLevel() throws Exception {
128129
}
129130

130131
@Test
131-
public void testSpringValidationFieldType() throws Exception {
132+
public void testSpringValidationFieldType() {
132133
LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean();
133134
validator.afterPropertiesSet();
134135

@@ -143,7 +144,7 @@ public void testSpringValidationFieldType() throws Exception {
143144
}
144145

145146
@Test
146-
public void testSpringValidation() throws Exception {
147+
public void testSpringValidation() {
147148
LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean();
148149
validator.afterPropertiesSet();
149150

@@ -171,7 +172,7 @@ public void testSpringValidation() throws Exception {
171172
}
172173

173174
@Test
174-
public void testSpringValidationWithClassLevel() throws Exception {
175+
public void testSpringValidationWithClassLevel() {
175176
LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean();
176177
validator.afterPropertiesSet();
177178

@@ -189,7 +190,7 @@ public void testSpringValidationWithClassLevel() throws Exception {
189190
}
190191

191192
@Test
192-
public void testSpringValidationWithAutowiredValidator() throws Exception {
193+
public void testSpringValidationWithAutowiredValidator() {
193194
ConfigurableApplicationContext ctx = new AnnotationConfigApplicationContext(
194195
LocalValidatorFactoryBean.class);
195196
LocalValidatorFactoryBean validator = ctx.getBean(LocalValidatorFactoryBean.class);
@@ -210,7 +211,7 @@ public void testSpringValidationWithAutowiredValidator() throws Exception {
210211
}
211212

212213
@Test
213-
public void testSpringValidationWithErrorInListElement() throws Exception {
214+
public void testSpringValidationWithErrorInListElement() {
214215
LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean();
215216
validator.afterPropertiesSet();
216217

@@ -228,7 +229,7 @@ public void testSpringValidationWithErrorInListElement() throws Exception {
228229
}
229230

230231
@Test
231-
public void testSpringValidationWithErrorInSetElement() throws Exception {
232+
public void testSpringValidationWithErrorInSetElement() {
232233
LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean();
233234
validator.afterPropertiesSet();
234235

@@ -246,7 +247,7 @@ public void testSpringValidationWithErrorInSetElement() throws Exception {
246247
}
247248

248249
@Test
249-
public void testInnerBeanValidation() throws Exception {
250+
public void testInnerBeanValidation() {
250251
LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean();
251252
validator.afterPropertiesSet();
252253

@@ -258,7 +259,7 @@ public void testInnerBeanValidation() throws Exception {
258259
}
259260

260261
@Test
261-
public void testValidationWithOptionalField() throws Exception {
262+
public void testValidationWithOptionalField() {
262263
LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean();
263264
validator.afterPropertiesSet();
264265

@@ -270,7 +271,7 @@ public void testValidationWithOptionalField() throws Exception {
270271
}
271272

272273
@Test
273-
public void testListValidation() throws Exception {
274+
public void testListValidation() {
274275
LocalValidatorFactoryBean validator = new LocalValidatorFactoryBean();
275276
validator.afterPropertiesSet();
276277

0 commit comments

Comments
 (0)