2828import org .junit .jupiter .api .BeforeEach ;
2929import org .junit .jupiter .api .Test ;
3030
31- import org .mockito .ArgumentMatchers ;
3231import org .springframework .context .i18n .LocaleContextHolder ;
3332import org .springframework .context .support .GenericApplicationContext ;
3433import org .springframework .core .env .MapPropertySource ;
4342import static org .mockito .ArgumentMatchers .eq ;
4443import static org .mockito .ArgumentMatchers .isNull ;
4544import static org .mockito .ArgumentMatchers .same ;
45+ import static org .mockito .BDDMockito .given ;
4646import static org .mockito .Mockito .mock ;
4747import 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