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
This commit is contained in:
Arnaud Cogoluègnes 2013-02-14 12:05:34 +01:00 committed by Rossen Stoyanchev
parent f0787bdb86
commit ccca82be1b
1 changed files with 10 additions and 3 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2012 the original author or authors. * Copyright 2002-2013 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -201,15 +201,22 @@ public class StandaloneMockMvcBuilder extends DefaultMockMvcBuilder<StandaloneMo
return this; return this;
} }
/** /**
* Set the HandlerExceptionResolver types to use. * Set the HandlerExceptionResolver types to use as a list.
*/ */
public StandaloneMockMvcBuilder setHandlerExceptionResolvers(List<HandlerExceptionResolver> exceptionResolvers) { public StandaloneMockMvcBuilder setHandlerExceptionResolvers(List<HandlerExceptionResolver> exceptionResolvers) {
this.handlerExceptionResolvers = exceptionResolvers; this.handlerExceptionResolvers = exceptionResolvers;
return this; return this;
} }
/**
* Set the HandlerExceptionResolver types to use as an array.
*/
public StandaloneMockMvcBuilder setHandlerExceptionResolvers(HandlerExceptionResolver... exceptionResolvers) {
this.handlerExceptionResolvers = Arrays.asList(exceptionResolvers);
return this;
}
/** /**
* Set up view resolution with the given {@link ViewResolver}s. * Set up view resolution with the given {@link ViewResolver}s.
* If not set, an {@link InternalResourceViewResolver} is used by default. * If not set, an {@link InternalResourceViewResolver} is used by default.