Fix overridden methods nullability
Issue: SPR-15869
This commit is contained in:
@@ -266,6 +266,7 @@ public class MockServletContext implements ServletContext {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public String getMimeType(String filePath) {
|
||||
String extension = StringUtils.getFilenameExtension(filePath);
|
||||
if (this.mimeTypes.containsKey(extension)) {
|
||||
|
||||
@@ -118,6 +118,7 @@ public class DefaultContextCache implements ContextCache {
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
@Nullable
|
||||
public ApplicationContext get(MergedContextConfiguration key) {
|
||||
Assert.notNull(key, "Key must not be null");
|
||||
ApplicationContext context = this.contextMap.get(key);
|
||||
|
||||
@@ -147,6 +147,7 @@ public class DefaultTestContext implements TestContext {
|
||||
return testMethod;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public final Throwable getTestException() {
|
||||
return this.testException;
|
||||
@@ -172,12 +173,14 @@ public class DefaultTestContext implements TestContext {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Object getAttribute(String name) {
|
||||
Assert.notNull(name, "Name must not be null");
|
||||
return this.attributes.get(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Object removeAttribute(String name) {
|
||||
Assert.notNull(name, "Name must not be null");
|
||||
return this.attributes.remove(name);
|
||||
|
||||
@@ -251,6 +251,7 @@ public abstract class TestContextTransactionUtils {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import java.util.List;
|
||||
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.core.annotation.AnnotatedElementUtils;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.test.context.ContextConfigurationAttributes;
|
||||
import org.springframework.test.context.ContextCustomizer;
|
||||
import org.springframework.test.context.ContextCustomizerFactory;
|
||||
@@ -46,6 +47,7 @@ class MockServerContainerContextCustomizerFactory implements ContextCustomizerFa
|
||||
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public ContextCustomizer createContextCustomizer(Class<?> testClass,
|
||||
List<ContextConfigurationAttributes> configAttributes) {
|
||||
|
||||
|
||||
@@ -21,6 +21,8 @@ import java.time.Duration;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* {@code ExchangeResult} variant with the response body decoded as
|
||||
* {@code Flux<T>} but not yet consumed.
|
||||
@@ -87,6 +89,7 @@ public class FluxExchangeResult<T> extends ExchangeResult {
|
||||
* via {@code getResponseBody.ignoreElements()}.
|
||||
*/
|
||||
@Override
|
||||
@Nullable
|
||||
public byte[] getResponseBodyContent() {
|
||||
return this.body.ignoreElements()
|
||||
.timeout(this.timeout, Mono.error(TIMEOUT_ERROR))
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.springframework.test.web.servlet.setup;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.test.web.servlet.request.RequestPostProcessor;
|
||||
import org.springframework.web.context.WebApplicationContext;
|
||||
|
||||
@@ -32,6 +33,7 @@ public abstract class MockMvcConfigurerAdapter implements MockMvcConfigurer {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public RequestPostProcessor beforeMockMvcCreated(ConfigurableMockMvcBuilder<?> builder, WebApplicationContext cxt) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -539,6 +539,7 @@ public class StandaloneMockMvcBuilder extends AbstractMockMvcBuilder<StandaloneM
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public View resolveViewName(String viewName, Locale locale) throws Exception {
|
||||
return this.view;
|
||||
}
|
||||
|
||||
@@ -275,6 +275,7 @@ class StubWebApplicationContext implements WebApplicationContext {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public <A extends Annotation> A findAnnotationOnBean(String beanName, Class<A> annotationType)
|
||||
throws NoSuchBeanDefinitionException{
|
||||
|
||||
@@ -322,6 +323,7 @@ class StubWebApplicationContext implements WebApplicationContext {
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public ClassLoader getClassLoader() {
|
||||
return ClassUtils.getDefaultClassLoader();
|
||||
}
|
||||
@@ -399,11 +401,13 @@ class StubWebApplicationContext implements WebApplicationContext {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Object resolveDependency(DependencyDescriptor descriptor, @Nullable String requestingBeanName) {
|
||||
throw new UnsupportedOperationException("Dependency resolution not supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Object resolveDependency(DependencyDescriptor descriptor, @Nullable String requestingBeanName,
|
||||
@Nullable Set<String> autowiredBeanNames, @Nullable TypeConverter typeConverter) {
|
||||
throw new UnsupportedOperationException("Dependency resolution not supported");
|
||||
|
||||
Reference in New Issue
Block a user