From ccca82be1b05accfca5a032237dc94f39e1ccfa5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Cogolu=C3=A8gnes?= Date: Thu, 14 Feb 2013 12:05:34 +0100 Subject: [PATCH] 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 --- .../web/servlet/setup/StandaloneMockMvcBuilder.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/spring-test-mvc/src/main/java/org/springframework/test/web/servlet/setup/StandaloneMockMvcBuilder.java b/spring-test-mvc/src/main/java/org/springframework/test/web/servlet/setup/StandaloneMockMvcBuilder.java index b9597c196e..079a42fc01 100644 --- a/spring-test-mvc/src/main/java/org/springframework/test/web/servlet/setup/StandaloneMockMvcBuilder.java +++ b/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"); * you may not use this file except in compliance with the License. @@ -201,15 +201,22 @@ public class StandaloneMockMvcBuilder extends DefaultMockMvcBuilder exceptionResolvers) { this.handlerExceptionResolvers = exceptionResolvers; 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. * If not set, an {@link InternalResourceViewResolver} is used by default.