From 64c96c579df7a2a9153732881632f9f4bfb856b7 Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Sat, 7 May 2022 16:14:41 +0200 Subject: [PATCH] Polish contribution See gh-28422 --- .../annotation/ErrorsMethodArgumentResolver.java | 5 +++-- .../ErrorsMethodArgumentResolverTests.java | 15 +++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/result/method/annotation/ErrorsMethodArgumentResolver.java b/spring-webflux/src/main/java/org/springframework/web/reactive/result/method/annotation/ErrorsMethodArgumentResolver.java index 4493f0416d9c..7f6a1dea9f5a 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/result/method/annotation/ErrorsMethodArgumentResolver.java +++ b/spring-webflux/src/main/java/org/springframework/web/reactive/result/method/annotation/ErrorsMethodArgumentResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2020 the original author or authors. + * Copyright 2002-2022 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. @@ -33,7 +33,8 @@ /** * Resolve {@link Errors} or {@link BindingResult} method arguments. - * An {@code Errors} argument is expected to appear immediately after the + * + *

An {@code Errors} argument is expected to appear immediately after the * model attribute in the method signature. * * @author Rossen Stoyanchev diff --git a/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/ErrorsMethodArgumentResolverTests.java b/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/ErrorsMethodArgumentResolverTests.java index 44e0c7080078..499a5b85dab6 100644 --- a/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/ErrorsMethodArgumentResolverTests.java +++ b/spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/ErrorsMethodArgumentResolverTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2020 the original author or authors. + * Copyright 2002-2022 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. @@ -82,12 +82,11 @@ void resolve() { } @Test - void resolveOnBindingResultAndModelAttributeWithCustomValue() { + void resolveOnBindingResultAndModelAttributeWithCustomName() { BindingResult bindingResult = createBindingResult(new Foo(), "custom"); this.bindingContext.getModel().asMap().put(BindingResult.MODEL_KEY_PREFIX + "custom", bindingResult); - ResolvableMethod testMethod = ResolvableMethod.on(getClass()) - .named("handleWithModelAttributeValue").build(); + ResolvableMethod testMethod = ResolvableMethod.on(getClass()).named("handleWithCustomModelAttributeName").build(); MethodParameter parameter = testMethod.arg(Errors.class); Object actual = this.resolver.resolveArgument(parameter, this.bindingContext, this.exchange) @@ -114,12 +113,11 @@ void resolveWithMono() { } @Test - void resolveWithMonoOnBindingResultAndModelAttributeWithCustomValue() { + void resolveWithMonoOnBindingResultAndModelAttributeWithCustomName() { BindingResult bindingResult = createBindingResult(new Foo(), "custom"); this.bindingContext.getModel().asMap().put(BindingResult.MODEL_KEY_PREFIX + "custom", Mono.just(bindingResult)); - ResolvableMethod testMethod = ResolvableMethod.on(getClass()) - .named("handleWithModelAttributeValue").build(); + ResolvableMethod testMethod = ResolvableMethod.on(getClass()).named("handleWithCustomModelAttributeName").build(); MethodParameter parameter = testMethod.arg(Errors.class); Object actual = this.resolver.resolveArgument(parameter, this.bindingContext, this.exchange) @@ -181,7 +179,7 @@ void handle( } @SuppressWarnings("unused") - void handleWithModelAttributeValue( + void handleWithCustomModelAttributeName( @ModelAttribute("custom") Foo foo, Errors errors, @ModelAttribute Mono fooMono, @@ -189,4 +187,5 @@ void handleWithModelAttributeValue( Mono errorsMono, String string) { } + }