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
master
Arnaud Cogoluègnes 12 years ago committed by Rossen Stoyanchev
parent f0787bdb86
commit ccca82be1b
  1. 13
      spring-test-mvc/src/main/java/org/springframework/test/web/servlet/setup/StandaloneMockMvcBuilder.java

@ -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.

Loading…
Cancel
Save