Apply code cleanup rules to projects
Apply automated cleanup rules to add `@Override` and `@Deprecated` annotations and to fix class references used with static methods. Issue gh-8945
This commit is contained in:
@@ -31,10 +31,12 @@ public class MockFilterConfig implements FilterConfig {
|
||||
|
||||
private Map map = new HashMap();
|
||||
|
||||
@Override
|
||||
public String getFilterName() {
|
||||
throw new UnsupportedOperationException("mock method not implemented");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInitParameter(String arg0) {
|
||||
Object result = this.map.get(arg0);
|
||||
|
||||
@@ -46,10 +48,12 @@ public class MockFilterConfig implements FilterConfig {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enumeration getInitParameterNames() {
|
||||
throw new UnsupportedOperationException("mock method not implemented");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServletContext getServletContext() {
|
||||
throw new UnsupportedOperationException("mock method not implemented");
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ public class MockPortResolver implements PortResolver {
|
||||
this.https = https;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getServerPort(ServletRequest request) {
|
||||
if ((request.getScheme() != null) && request.getScheme().equals("https")) {
|
||||
return this.https;
|
||||
|
||||
@@ -199,6 +199,7 @@ public class ChannelDecisionManagerImplTests {
|
||||
this.failIfCalled = failIfCalled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decide(FilterInvocation invocation, Collection<ConfigAttribute> config) throws IOException {
|
||||
Iterator iter = config.iterator();
|
||||
|
||||
@@ -217,6 +218,7 @@ public class ChannelDecisionManagerImplTests {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supports(ConfigAttribute attribute) {
|
||||
if (attribute.getAttribute().equals(this.configAttribute)) {
|
||||
return true;
|
||||
|
||||
@@ -161,12 +161,14 @@ public class ChannelProcessingFilterTests {
|
||||
this.supportAttribute = supportAttribute;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decide(FilterInvocation invocation, Collection<ConfigAttribute> config) throws IOException {
|
||||
if (this.commitAResponse) {
|
||||
invocation.getHttpResponse().sendRedirect("/redirected");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supports(ConfigAttribute attribute) {
|
||||
if (attribute.getAttribute().equals(this.supportAttribute)) {
|
||||
return true;
|
||||
@@ -192,6 +194,7 @@ public class ChannelProcessingFilterTests {
|
||||
this.provideIterator = provideIterator;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<ConfigAttribute> getAttributes(Object object) throws IllegalArgumentException {
|
||||
FilterInvocation fi = (FilterInvocation) object;
|
||||
|
||||
@@ -203,6 +206,7 @@ public class ChannelProcessingFilterTests {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<ConfigAttribute> getAllConfigAttributes() {
|
||||
if (!this.provideIterator) {
|
||||
return null;
|
||||
@@ -211,6 +215,7 @@ public class ChannelProcessingFilterTests {
|
||||
return this.toReturn;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supports(Class<?> clazz) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -506,6 +506,7 @@ public class AbstractAuthenticationProcessingFilterTests {
|
||||
this.grantAccess = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response)
|
||||
throws AuthenticationException {
|
||||
if (this.grantAccess) {
|
||||
@@ -532,6 +533,7 @@ public class AbstractAuthenticationProcessingFilterTests {
|
||||
this.expectToProceed = expectToProceed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doFilter(ServletRequest request, ServletResponse response) {
|
||||
if (!this.expectToProceed) {
|
||||
fail("Did not expect filter chain to proceed");
|
||||
|
||||
@@ -114,6 +114,7 @@ public class AnonymousAuthenticationFilterTests {
|
||||
this.expectToProceed = expectToProceed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doFilter(ServletRequest request, ServletResponse response) {
|
||||
if (!this.expectToProceed) {
|
||||
fail("Did not expect filter chain to proceed");
|
||||
|
||||
@@ -60,10 +60,12 @@ public class AbstractPreAuthenticatedProcessingFilterTests {
|
||||
@Before
|
||||
public void createFilter() {
|
||||
this.filter = new AbstractPreAuthenticatedProcessingFilter() {
|
||||
@Override
|
||||
protected Object getPreAuthenticatedCredentials(HttpServletRequest request) {
|
||||
return "n/a";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object getPreAuthenticatedPrincipal(HttpServletRequest request) {
|
||||
return "doesntmatter";
|
||||
}
|
||||
@@ -434,10 +436,12 @@ public class AbstractPreAuthenticatedProcessingFilterTests {
|
||||
|
||||
private boolean initFilterBeanInvoked;
|
||||
|
||||
@Override
|
||||
protected Object getPreAuthenticatedPrincipal(HttpServletRequest httpRequest) {
|
||||
return this.principal;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object getPreAuthenticatedCredentials(HttpServletRequest httpRequest) {
|
||||
return "testCredentials";
|
||||
}
|
||||
|
||||
@@ -60,6 +60,7 @@ public class PreAuthenticatedGrantedAuthoritiesWebAuthenticationDetailsTests {
|
||||
MockHttpServletRequest req = new MockHttpServletRequest() {
|
||||
private Set<String> roles = new HashSet<>(Arrays.asList(aRoles));
|
||||
|
||||
@Override
|
||||
public boolean isUserInRole(String arg0) {
|
||||
return this.roles.contains(arg0);
|
||||
}
|
||||
|
||||
@@ -169,6 +169,7 @@ public class J2eeBasedPreAuthenticatedWebAuthenticationDetailsSourceTests {
|
||||
|
||||
private Set<String> roles = new HashSet<>(Arrays.asList(aRoles));
|
||||
|
||||
@Override
|
||||
public boolean isUserInRole(String arg0) {
|
||||
return this.roles.contains(arg0);
|
||||
}
|
||||
|
||||
@@ -51,6 +51,7 @@ public class J2eePreAuthenticatedProcessingFilterTests {
|
||||
|
||||
private Set<String> roles = new HashSet<>(Arrays.asList(aRoles));
|
||||
|
||||
@Override
|
||||
public boolean isUserInRole(String arg0) {
|
||||
return this.roles.contains(arg0);
|
||||
}
|
||||
|
||||
@@ -36,10 +36,12 @@ public class WebXmlJ2eeDefinedRolesRetrieverTests {
|
||||
WebXmlMappableAttributesRetriever rolesRetriever = new WebXmlMappableAttributesRetriever();
|
||||
|
||||
rolesRetriever.setResourceLoader(new ResourceLoader() {
|
||||
@Override
|
||||
public ClassLoader getClassLoader() {
|
||||
return Thread.currentThread().getContextClassLoader();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Resource getResource(String location) {
|
||||
return webXml;
|
||||
}
|
||||
@@ -55,10 +57,12 @@ public class WebXmlJ2eeDefinedRolesRetrieverTests {
|
||||
final Resource webXml = new ClassPathResource("webxml/NoRoles.web.xml");
|
||||
WebXmlMappableAttributesRetriever rolesRetriever = new WebXmlMappableAttributesRetriever();
|
||||
rolesRetriever.setResourceLoader(new ResourceLoader() {
|
||||
@Override
|
||||
public ClassLoader getClassLoader() {
|
||||
return Thread.currentThread().getContextClassLoader();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Resource getResource(String location) {
|
||||
return webXml;
|
||||
}
|
||||
|
||||
@@ -311,6 +311,7 @@ public class AbstractRememberMeServicesTests {
|
||||
public void cookieTheftExceptionShouldBeRethrown() {
|
||||
MockRememberMeServices services = new MockRememberMeServices(this.uds) {
|
||||
|
||||
@Override
|
||||
protected UserDetails processAutoLoginCookie(String[] cookieTokens, HttpServletRequest request,
|
||||
HttpServletResponse response) {
|
||||
throw new CookieTheftException("Pretending cookie was stolen");
|
||||
@@ -339,7 +340,7 @@ public class AbstractRememberMeServicesTests {
|
||||
|
||||
// Parameter set to true
|
||||
services = new MockRememberMeServices(this.uds);
|
||||
request.setParameter(MockRememberMeServices.DEFAULT_PARAMETER, "true");
|
||||
request.setParameter(AbstractRememberMeServices.DEFAULT_PARAMETER, "true");
|
||||
services.loginSuccess(request, response, auth);
|
||||
assertThat(services.loginSuccessCalled).isTrue();
|
||||
|
||||
@@ -352,7 +353,7 @@ public class AbstractRememberMeServicesTests {
|
||||
|
||||
// Parameter set to false
|
||||
services = new MockRememberMeServices(this.uds);
|
||||
request.setParameter(MockRememberMeServices.DEFAULT_PARAMETER, "false");
|
||||
request.setParameter(AbstractRememberMeServices.DEFAULT_PARAMETER, "false");
|
||||
services.loginSuccess(request, response, auth);
|
||||
assertThat(services.loginSuccessCalled).isFalse();
|
||||
|
||||
@@ -370,6 +371,7 @@ public class AbstractRememberMeServicesTests {
|
||||
request.setContextPath("contextpath");
|
||||
MockRememberMeServices services = new MockRememberMeServices(this.uds) {
|
||||
|
||||
@Override
|
||||
protected String encodeCookie(String[] cookieTokens) {
|
||||
return cookieTokens[0];
|
||||
}
|
||||
@@ -393,6 +395,7 @@ public class AbstractRememberMeServicesTests {
|
||||
|
||||
MockRememberMeServices services = new MockRememberMeServices(this.uds) {
|
||||
|
||||
@Override
|
||||
protected String encodeCookie(String[] cookieTokens) {
|
||||
return cookieTokens[0];
|
||||
}
|
||||
@@ -499,11 +502,13 @@ public class AbstractRememberMeServicesTests {
|
||||
this(new MockUserDetailsService(null, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onLoginSuccess(HttpServletRequest request, HttpServletResponse response,
|
||||
Authentication successfulAuthentication) {
|
||||
this.loginSuccessCalled = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected UserDetails processAutoLoginCookie(String[] cookieTokens, HttpServletRequest request,
|
||||
HttpServletResponse response) throws RememberMeAuthenticationException {
|
||||
if (cookieTokens.length != 3) {
|
||||
@@ -532,6 +537,7 @@ public class AbstractRememberMeServicesTests {
|
||||
this.throwException = throwException;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserDetails loadUserByUsername(String username) {
|
||||
if (this.throwException) {
|
||||
throw new UsernameNotFoundException("as requested by mock");
|
||||
|
||||
@@ -147,19 +147,23 @@ public class PersistentTokenBasedRememberMeServicesTests {
|
||||
this.storedToken = token;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createNewToken(PersistentRememberMeToken token) {
|
||||
this.storedToken = token;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateToken(String series, String tokenValue, Date lastUsed) {
|
||||
this.storedToken = new PersistentRememberMeToken(this.storedToken.getUsername(),
|
||||
this.storedToken.getSeries(), tokenValue, lastUsed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PersistentRememberMeToken getTokenForSeries(String seriesId) {
|
||||
return this.storedToken;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeUserTokens(String username) {
|
||||
}
|
||||
|
||||
|
||||
@@ -122,6 +122,7 @@ public class RememberMeAuthenticationFilterTests {
|
||||
|
||||
RememberMeAuthenticationFilter filter = new RememberMeAuthenticationFilter(am,
|
||||
new MockRememberMeServices(this.remembered)) {
|
||||
@Override
|
||||
protected void onUnsuccessfulAuthentication(HttpServletRequest request, HttpServletResponse response,
|
||||
AuthenticationException failed) {
|
||||
super.onUnsuccessfulAuthentication(request, response, failed);
|
||||
@@ -167,13 +168,16 @@ public class RememberMeAuthenticationFilterTests {
|
||||
this.authToReturn = authToReturn;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Authentication autoLogin(HttpServletRequest request, HttpServletResponse response) {
|
||||
return this.authToReturn;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loginFail(HttpServletRequest request, HttpServletResponse response) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loginSuccess(HttpServletRequest request, HttpServletResponse response,
|
||||
Authentication successfulAuthentication) {
|
||||
}
|
||||
|
||||
@@ -292,7 +292,7 @@ public class TokenBasedRememberMeServicesTests {
|
||||
// SEC-822
|
||||
this.services.setTokenValiditySeconds(500000000);
|
||||
MockHttpServletRequest request = new MockHttpServletRequest();
|
||||
request.addParameter(TokenBasedRememberMeServices.DEFAULT_PARAMETER, "true");
|
||||
request.addParameter(AbstractRememberMeServices.DEFAULT_PARAMETER, "true");
|
||||
|
||||
MockHttpServletResponse response = new MockHttpServletResponse();
|
||||
this.services.loginSuccess(request, response,
|
||||
@@ -312,7 +312,7 @@ public class TokenBasedRememberMeServicesTests {
|
||||
@Test
|
||||
public void loginSuccessNormalWithUserDetailsBasedPrincipalSetsExpectedCookie() {
|
||||
MockHttpServletRequest request = new MockHttpServletRequest();
|
||||
request.addParameter(TokenBasedRememberMeServices.DEFAULT_PARAMETER, "true");
|
||||
request.addParameter(AbstractRememberMeServices.DEFAULT_PARAMETER, "true");
|
||||
|
||||
MockHttpServletResponse response = new MockHttpServletResponse();
|
||||
this.services.loginSuccess(request, response,
|
||||
|
||||
@@ -553,6 +553,7 @@ public class SwitchUserFilterTests {
|
||||
|
||||
private String password = "hawaii50";
|
||||
|
||||
@Override
|
||||
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
|
||||
// jacklord, dano (active)
|
||||
// mcgarrett (disabled)
|
||||
|
||||
@@ -107,6 +107,7 @@ public class AbstractSecurityWebApplicationInitializerTests {
|
||||
when(context.addFilter(eq("springSecurityFilterChain"), proxyCaptor.capture())).thenReturn(registration);
|
||||
|
||||
new AbstractSecurityWebApplicationInitializer() {
|
||||
@Override
|
||||
protected boolean enableHttpSessionEventPublisher() {
|
||||
return true;
|
||||
}
|
||||
@@ -129,6 +130,7 @@ public class AbstractSecurityWebApplicationInitializerTests {
|
||||
when(context.addFilter(eq("springSecurityFilterChain"), proxyCaptor.capture())).thenReturn(registration);
|
||||
|
||||
new AbstractSecurityWebApplicationInitializer() {
|
||||
@Override
|
||||
protected EnumSet<DispatcherType> getSecurityDispatcherTypes() {
|
||||
return EnumSet.of(DispatcherType.REQUEST, DispatcherType.ERROR, DispatcherType.FORWARD);
|
||||
}
|
||||
@@ -152,6 +154,7 @@ public class AbstractSecurityWebApplicationInitializerTests {
|
||||
when(context.addFilter(eq("springSecurityFilterChain"), proxyCaptor.capture())).thenReturn(registration);
|
||||
|
||||
new AbstractSecurityWebApplicationInitializer() {
|
||||
@Override
|
||||
protected String getDispatcherWebApplicationContextSuffix() {
|
||||
return "dispatcher";
|
||||
}
|
||||
@@ -191,6 +194,7 @@ public class AbstractSecurityWebApplicationInitializerTests {
|
||||
when(context.addFilter(anyString(), eq(filter2))).thenReturn(registration);
|
||||
|
||||
new AbstractSecurityWebApplicationInitializer() {
|
||||
@Override
|
||||
protected void afterSpringSecurityFilterChain(ServletContext servletContext) {
|
||||
insertFilters(context, filter1, filter2);
|
||||
}
|
||||
@@ -216,6 +220,7 @@ public class AbstractSecurityWebApplicationInitializerTests {
|
||||
when(context.addFilter(eq("springSecurityFilterChain"), proxyCaptor.capture())).thenReturn(registration);
|
||||
|
||||
assertThatCode(() -> new AbstractSecurityWebApplicationInitializer() {
|
||||
@Override
|
||||
protected void afterSpringSecurityFilterChain(ServletContext servletContext) {
|
||||
insertFilters(context, filter1);
|
||||
}
|
||||
@@ -238,6 +243,7 @@ public class AbstractSecurityWebApplicationInitializerTests {
|
||||
when(context.addFilter(eq("springSecurityFilterChain"), proxyCaptor.capture())).thenReturn(registration);
|
||||
|
||||
assertThatCode(() -> new AbstractSecurityWebApplicationInitializer() {
|
||||
@Override
|
||||
protected void afterSpringSecurityFilterChain(ServletContext servletContext) {
|
||||
insertFilters(context);
|
||||
}
|
||||
@@ -259,6 +265,7 @@ public class AbstractSecurityWebApplicationInitializerTests {
|
||||
when(context.addFilter(anyString(), eq(filter))).thenReturn(registration);
|
||||
|
||||
assertThatCode(() -> new AbstractSecurityWebApplicationInitializer() {
|
||||
@Override
|
||||
protected void afterSpringSecurityFilterChain(ServletContext servletContext) {
|
||||
insertFilters(context, filter, null);
|
||||
}
|
||||
@@ -282,6 +289,7 @@ public class AbstractSecurityWebApplicationInitializerTests {
|
||||
when(context.addFilter(anyString(), eq(filter2))).thenReturn(registration);
|
||||
|
||||
new AbstractSecurityWebApplicationInitializer() {
|
||||
@Override
|
||||
protected void afterSpringSecurityFilterChain(ServletContext servletContext) {
|
||||
appendFilters(context, filter1, filter2);
|
||||
}
|
||||
@@ -305,6 +313,7 @@ public class AbstractSecurityWebApplicationInitializerTests {
|
||||
when(context.addFilter(eq("springSecurityFilterChain"), proxyCaptor.capture())).thenReturn(registration);
|
||||
|
||||
assertThatCode(() -> new AbstractSecurityWebApplicationInitializer() {
|
||||
@Override
|
||||
protected void afterSpringSecurityFilterChain(ServletContext servletContext) {
|
||||
appendFilters(context, filter1);
|
||||
}
|
||||
@@ -327,6 +336,7 @@ public class AbstractSecurityWebApplicationInitializerTests {
|
||||
when(context.addFilter(eq("springSecurityFilterChain"), proxyCaptor.capture())).thenReturn(registration);
|
||||
|
||||
assertThatCode(() -> new AbstractSecurityWebApplicationInitializer() {
|
||||
@Override
|
||||
protected void afterSpringSecurityFilterChain(ServletContext servletContext) {
|
||||
appendFilters(context);
|
||||
}
|
||||
@@ -348,6 +358,7 @@ public class AbstractSecurityWebApplicationInitializerTests {
|
||||
when(context.addFilter(anyString(), eq(filter))).thenReturn(registration);
|
||||
|
||||
assertThatCode(() -> new AbstractSecurityWebApplicationInitializer() {
|
||||
@Override
|
||||
protected void afterSpringSecurityFilterChain(ServletContext servletContext) {
|
||||
appendFilters(context, filter, null);
|
||||
}
|
||||
|
||||
@@ -130,6 +130,7 @@ public class WebAsyncManagerIntegrationFilterTests {
|
||||
|
||||
private Thread t;
|
||||
|
||||
@Override
|
||||
public Thread newThread(Runnable r) {
|
||||
this.t = new Thread(r);
|
||||
return this.t;
|
||||
@@ -143,6 +144,7 @@ public class WebAsyncManagerIntegrationFilterTests {
|
||||
|
||||
private class VerifyingCallable implements Callable<SecurityContext> {
|
||||
|
||||
@Override
|
||||
public SecurityContext call() {
|
||||
return SecurityContextHolder.getContext();
|
||||
}
|
||||
|
||||
@@ -100,9 +100,11 @@ public class JaasApiIntegrationFilterTests {
|
||||
};
|
||||
this.testConfiguration = new Configuration() {
|
||||
|
||||
@Override
|
||||
public void refresh() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public AppConfigurationEntry[] getAppConfigurationEntry(String name) {
|
||||
return new AppConfigurationEntry[] { new AppConfigurationEntry(TestLoginModule.class.getName(),
|
||||
LoginModuleControlFlag.REQUIRED, new HashMap<>()) };
|
||||
@@ -193,6 +195,7 @@ public class JaasApiIntegrationFilterTests {
|
||||
private void assertJaasSubjectEquals(final Subject expectedValue) throws Exception {
|
||||
MockFilterChain chain = new MockFilterChain() {
|
||||
|
||||
@Override
|
||||
public void doFilter(ServletRequest request, ServletResponse response)
|
||||
throws IOException, ServletException {
|
||||
// See if the subject was updated
|
||||
|
||||
@@ -110,34 +110,42 @@ public class HttpSessionRequestCacheTests {
|
||||
this.delegate = delegate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRedirectUrl() {
|
||||
return this.delegate.getRedirectUrl();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Cookie> getCookies() {
|
||||
return this.delegate.getCookies();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMethod() {
|
||||
return this.delegate.getMethod();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getHeaderValues(String name) {
|
||||
return this.delegate.getHeaderValues(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<String> getHeaderNames() {
|
||||
return this.delegate.getHeaderNames();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Locale> getLocales() {
|
||||
return this.delegate.getLocales();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getParameterValues(String name) {
|
||||
return this.delegate.getParameterValues(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String[]> getParameterMap() {
|
||||
return this.delegate.getParameterMap();
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ import org.junit.Test;
|
||||
|
||||
import org.springframework.mock.web.MockHttpSession;
|
||||
import org.springframework.mock.web.MockServletContext;
|
||||
import org.springframework.web.context.WebApplicationContext;
|
||||
import org.springframework.web.context.support.StaticWebApplicationContext;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
@@ -43,7 +44,7 @@ public class HttpSessionEventPublisherTests {
|
||||
StaticWebApplicationContext context = new StaticWebApplicationContext();
|
||||
|
||||
MockServletContext servletContext = new MockServletContext();
|
||||
servletContext.setAttribute(StaticWebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, context);
|
||||
servletContext.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, context);
|
||||
|
||||
context.setServletContext(servletContext);
|
||||
context.registerSingleton("listener", MockApplicationListener.class, null);
|
||||
|
||||
@@ -40,6 +40,7 @@ public class MockApplicationListener implements ApplicationListener<ApplicationE
|
||||
return this.destroyedEvent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onApplicationEvent(ApplicationEvent event) {
|
||||
if (event instanceof HttpSessionCreatedEvent) {
|
||||
this.createdEvent = (HttpSessionCreatedEvent) event;
|
||||
|
||||
@@ -56,6 +56,7 @@ public class ThrowableAnalyzerTests {
|
||||
*/
|
||||
public static final class NonStandardExceptionCauseExtractor implements ThrowableCauseExtractor {
|
||||
|
||||
@Override
|
||||
public Throwable extractCause(Throwable throwable) {
|
||||
ThrowableAnalyzer.verifyThrowableHierarchy(throwable, NonStandardException.class);
|
||||
return ((NonStandardException) throwable).resolveCause();
|
||||
|
||||
Reference in New Issue
Block a user