|
|
@ -1,5 +1,5 @@
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
* Copyright 2012-2017 the original author or authors.
|
|
|
|
* Copyright 2012-2018 the original author or authors.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
@ -68,9 +68,9 @@ public class ServletRegistrationBeanTests {
|
|
|
|
@Before
|
|
|
|
@Before
|
|
|
|
public void setupMocks() {
|
|
|
|
public void setupMocks() {
|
|
|
|
MockitoAnnotations.initMocks(this);
|
|
|
|
MockitoAnnotations.initMocks(this);
|
|
|
|
given(this.servletContext.addServlet(anyString(), (Servlet) any()))
|
|
|
|
given(this.servletContext.addServlet(anyString(), any(Servlet.class)))
|
|
|
|
.willReturn(this.registration);
|
|
|
|
.willReturn(this.registration);
|
|
|
|
given(this.servletContext.addFilter(anyString(), (Filter) any()))
|
|
|
|
given(this.servletContext.addFilter(anyString(), any(Filter.class)))
|
|
|
|
.willReturn(this.filterRegistration);
|
|
|
|
.willReturn(this.filterRegistration);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -88,7 +88,7 @@ public class ServletRegistrationBeanTests {
|
|
|
|
public void startupWithDoubleRegistration() throws Exception {
|
|
|
|
public void startupWithDoubleRegistration() throws Exception {
|
|
|
|
ServletRegistrationBean<MockServlet> bean = new ServletRegistrationBean<>(
|
|
|
|
ServletRegistrationBean<MockServlet> bean = new ServletRegistrationBean<>(
|
|
|
|
this.servlet);
|
|
|
|
this.servlet);
|
|
|
|
given(this.servletContext.addServlet(anyString(), (Servlet) any()))
|
|
|
|
given(this.servletContext.addServlet(anyString(), any(Servlet.class)))
|
|
|
|
.willReturn(null);
|
|
|
|
.willReturn(null);
|
|
|
|
bean.onStartup(this.servletContext);
|
|
|
|
bean.onStartup(this.servletContext);
|
|
|
|
verify(this.servletContext).addServlet("mockServlet", this.servlet);
|
|
|
|
verify(this.servletContext).addServlet("mockServlet", this.servlet);
|
|
|
@ -207,7 +207,7 @@ public class ServletRegistrationBeanTests {
|
|
|
|
ServletRegistrationBean<MockServlet> bean = new ServletRegistrationBean<>(
|
|
|
|
ServletRegistrationBean<MockServlet> bean = new ServletRegistrationBean<>(
|
|
|
|
this.servlet, false);
|
|
|
|
this.servlet, false);
|
|
|
|
bean.onStartup(this.servletContext);
|
|
|
|
bean.onStartup(this.servletContext);
|
|
|
|
verify(this.registration, never()).addMapping((String[]) any());
|
|
|
|
verify(this.registration, never()).addMapping(any(String[].class));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|