Skip to content

Commit 3d0fffa

Browse files
committed
Polish contribution
See gh-33945
1 parent 71f872e commit 3d0fffa

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

spring-webmvc/src/test/java/org/springframework/web/servlet/tags/EvalTagTests.java

+9-8
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
import org.junit.jupiter.api.BeforeEach;
2929
import org.junit.jupiter.api.Test;
3030

31-
import org.mockito.ArgumentMatchers;
3231
import org.springframework.context.i18n.LocaleContextHolder;
3332
import org.springframework.context.support.GenericApplicationContext;
3433
import org.springframework.core.env.MapPropertySource;
@@ -43,9 +42,9 @@
4342
import static org.mockito.ArgumentMatchers.eq;
4443
import static org.mockito.ArgumentMatchers.isNull;
4544
import static org.mockito.ArgumentMatchers.same;
45+
import static org.mockito.BDDMockito.given;
4646
import static org.mockito.Mockito.mock;
4747
import static org.mockito.Mockito.spy;
48-
import static org.mockito.Mockito.when;
4948

5049
/**
5150
* @author Keith Donald
@@ -62,16 +61,17 @@ void setup() {
6261
LocaleContextHolder.setDefaultLocale(Locale.UK);
6362

6463
context = spy(createPageContext());
65-
final ELContext elContext = mock(ELContext.class);
66-
final ELResolver elResolver = when(mock(ELResolver.class).getValue(same(elContext), isNull(), eq("pageContext")))
67-
.thenReturn(context)
68-
.getMock();
69-
when(elContext.getELResolver()).thenReturn(elResolver);
70-
when(context.getELContext()).thenReturn(elContext);
64+
ELContext elContext = mock();
65+
ELResolver elResolver = mock();
66+
given(elResolver.getValue(same(elContext), isNull(), eq("pageContext"))).willReturn(context);
67+
given(elContext.getELResolver()).willReturn(elResolver);
68+
given(context.getELContext()).willReturn(elContext);
69+
7170
FormattingConversionServiceFactoryBean factory = new FormattingConversionServiceFactoryBean();
7271
factory.afterPropertiesSet();
7372
context.getRequest().setAttribute("org.springframework.core.convert.ConversionService", factory.getObject());
7473
context.getRequest().setAttribute("bean", new Bean());
74+
7575
tag = new EvalTag();
7676
tag.setPageContext(context);
7777
}
@@ -206,6 +206,7 @@ void resolveImplicitVariable() throws Exception {
206206
assertThat(((MockHttpServletResponse) context.getResponse()).getContentAsString()).isEqualTo("MockPageContext");
207207
}
208208

209+
209210
public static class Bean {
210211

211212
public String method() {

0 commit comments

Comments
 (0)