Skip to content

Commit ccca82b

Browse files
acogoluegnesrstoyanchev
authored andcommitted
Make StandaloneMockMvcBuilder interface consistent
The exception resolvers can now be set using a setter that expects varargs, just like other infrastructure beans. Issue: SPR-10279
1 parent f0787bd commit ccca82b

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

spring-test-mvc/src/main/java/org/springframework/test/web/servlet/setup/StandaloneMockMvcBuilder.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2012 the original author or authors.
2+
* Copyright 2002-2013 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.
@@ -201,15 +201,22 @@ public StandaloneMockMvcBuilder setCustomReturnValueHandlers(HandlerMethodReturn
201201
return this;
202202
}
203203

204-
205204
/**
206-
* Set the HandlerExceptionResolver types to use.
205+
* Set the HandlerExceptionResolver types to use as a list.
207206
*/
208207
public StandaloneMockMvcBuilder setHandlerExceptionResolvers(List<HandlerExceptionResolver> exceptionResolvers) {
209208
this.handlerExceptionResolvers = exceptionResolvers;
210209
return this;
211210
}
212211

212+
/**
213+
* Set the HandlerExceptionResolver types to use as an array.
214+
*/
215+
public StandaloneMockMvcBuilder setHandlerExceptionResolvers(HandlerExceptionResolver... exceptionResolvers) {
216+
this.handlerExceptionResolvers = Arrays.asList(exceptionResolvers);
217+
return this;
218+
}
219+
213220
/**
214221
* Set up view resolution with the given {@link ViewResolver}s.
215222
* If not set, an {@link InternalResourceViewResolver} is used by default.

0 commit comments

Comments
 (0)