28
28
import org .junit .jupiter .api .BeforeEach ;
29
29
import org .junit .jupiter .api .Test ;
30
30
31
- import org .mockito .ArgumentMatchers ;
32
31
import org .springframework .context .i18n .LocaleContextHolder ;
33
32
import org .springframework .context .support .GenericApplicationContext ;
34
33
import org .springframework .core .env .MapPropertySource ;
43
42
import static org .mockito .ArgumentMatchers .eq ;
44
43
import static org .mockito .ArgumentMatchers .isNull ;
45
44
import static org .mockito .ArgumentMatchers .same ;
45
+ import static org .mockito .BDDMockito .given ;
46
46
import static org .mockito .Mockito .mock ;
47
47
import static org .mockito .Mockito .spy ;
48
- import static org .mockito .Mockito .when ;
49
48
50
49
/**
51
50
* @author Keith Donald
@@ -62,16 +61,17 @@ void setup() {
62
61
LocaleContextHolder .setDefaultLocale (Locale .UK );
63
62
64
63
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
+
71
70
FormattingConversionServiceFactoryBean factory = new FormattingConversionServiceFactoryBean ();
72
71
factory .afterPropertiesSet ();
73
72
context .getRequest ().setAttribute ("org.springframework.core.convert.ConversionService" , factory .getObject ());
74
73
context .getRequest ().setAttribute ("bean" , new Bean ());
74
+
75
75
tag = new EvalTag ();
76
76
tag .setPageContext (context );
77
77
}
@@ -206,6 +206,7 @@ void resolveImplicitVariable() throws Exception {
206
206
assertThat (((MockHttpServletResponse ) context .getResponse ()).getContentAsString ()).isEqualTo ("MockPageContext" );
207
207
}
208
208
209
+
209
210
public static class Bean {
210
211
211
212
public String method () {
0 commit comments