Polish contribution
See gh-33945
This commit is contained in:
@@ -28,7 +28,6 @@ import org.junit.jupiter.api.AfterEach;
|
|||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import org.mockito.ArgumentMatchers;
|
|
||||||
import org.springframework.context.i18n.LocaleContextHolder;
|
import org.springframework.context.i18n.LocaleContextHolder;
|
||||||
import org.springframework.context.support.GenericApplicationContext;
|
import org.springframework.context.support.GenericApplicationContext;
|
||||||
import org.springframework.core.env.MapPropertySource;
|
import org.springframework.core.env.MapPropertySource;
|
||||||
@@ -43,9 +42,9 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||||||
import static org.mockito.ArgumentMatchers.eq;
|
import static org.mockito.ArgumentMatchers.eq;
|
||||||
import static org.mockito.ArgumentMatchers.isNull;
|
import static org.mockito.ArgumentMatchers.isNull;
|
||||||
import static org.mockito.ArgumentMatchers.same;
|
import static org.mockito.ArgumentMatchers.same;
|
||||||
|
import static org.mockito.BDDMockito.given;
|
||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
import static org.mockito.Mockito.spy;
|
import static org.mockito.Mockito.spy;
|
||||||
import static org.mockito.Mockito.when;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Keith Donald
|
* @author Keith Donald
|
||||||
@@ -62,16 +61,17 @@ class EvalTagTests extends AbstractTagTests {
|
|||||||
LocaleContextHolder.setDefaultLocale(Locale.UK);
|
LocaleContextHolder.setDefaultLocale(Locale.UK);
|
||||||
|
|
||||||
context = spy(createPageContext());
|
context = spy(createPageContext());
|
||||||
final ELContext elContext = mock(ELContext.class);
|
ELContext elContext = mock();
|
||||||
final ELResolver elResolver = when(mock(ELResolver.class).getValue(same(elContext), isNull(), eq("pageContext")))
|
ELResolver elResolver = mock();
|
||||||
.thenReturn(context)
|
given(elResolver.getValue(same(elContext), isNull(), eq("pageContext"))).willReturn(context);
|
||||||
.getMock();
|
given(elContext.getELResolver()).willReturn(elResolver);
|
||||||
when(elContext.getELResolver()).thenReturn(elResolver);
|
given(context.getELContext()).willReturn(elContext);
|
||||||
when(context.getELContext()).thenReturn(elContext);
|
|
||||||
FormattingConversionServiceFactoryBean factory = new FormattingConversionServiceFactoryBean();
|
FormattingConversionServiceFactoryBean factory = new FormattingConversionServiceFactoryBean();
|
||||||
factory.afterPropertiesSet();
|
factory.afterPropertiesSet();
|
||||||
context.getRequest().setAttribute("org.springframework.core.convert.ConversionService", factory.getObject());
|
context.getRequest().setAttribute("org.springframework.core.convert.ConversionService", factory.getObject());
|
||||||
context.getRequest().setAttribute("bean", new Bean());
|
context.getRequest().setAttribute("bean", new Bean());
|
||||||
|
|
||||||
tag = new EvalTag();
|
tag = new EvalTag();
|
||||||
tag.setPageContext(context);
|
tag.setPageContext(context);
|
||||||
}
|
}
|
||||||
@@ -206,6 +206,7 @@ class EvalTagTests extends AbstractTagTests {
|
|||||||
assertThat(((MockHttpServletResponse) context.getResponse()).getContentAsString()).isEqualTo("MockPageContext");
|
assertThat(((MockHttpServletResponse) context.getResponse()).getContentAsString()).isEqualTo("MockPageContext");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static class Bean {
|
public static class Bean {
|
||||||
|
|
||||||
public String method() {
|
public String method() {
|
||||||
|
|||||||
Reference in New Issue
Block a user