Replace and remove deprecated API usage

This commit is contained in:
Andy Wilkinson
2017-01-24 11:01:35 +00:00
parent f2df6e805e
commit 42cb053d49
4 changed files with 9 additions and 12 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -34,7 +34,6 @@ import org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration;
import org.springframework.boot.autoconfigure.liquibase.LiquibaseAutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Import;
import org.springframework.lang.UsesJava8;
// Flyway must go first
@SpringBootApplication
@@ -66,7 +65,6 @@ public class SpringBootHypermediaApplication implements CommandLineRunner {
createEvent("2016-11-01T12:00:00Z", "admin", "AUTHENTICATION_SUCCESS"));
}
@UsesJava8
private AuditEvent createEvent(String instant, String principal, String type) {
return new AuditEvent(Date.from(Instant.parse(instant)), principal, type,
Collections.<String, Object>emptyMap());

View File

@@ -76,7 +76,7 @@ public class MessageInterpolatorFactory implements ObjectFactory<MessageInterpol
private MessageInterpolator getFallback(String fallback) {
Class<?> interpolatorClass = ClassUtils.resolveClassName(fallback, null);
Object interpolator = BeanUtils.instantiate(interpolatorClass);
Object interpolator = BeanUtils.instantiateClass(interpolatorClass);
return (MessageInterpolator) interpolator;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -51,7 +51,7 @@ import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.http.HttpHeaders;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.anyObject;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.inOrder;
import static org.mockito.Mockito.mock;
@@ -84,7 +84,7 @@ public class JettyEmbeddedServletContainerFactoryTests
this.container = factory.getEmbeddedServletContainer();
InOrder ordered = inOrder((Object[]) configurations);
for (Configuration configuration : configurations) {
ordered.verify(configuration).configure((WebAppContext) anyObject());
ordered.verify(configuration).configure(any(WebAppContext.class));
}
}
@@ -100,7 +100,7 @@ public class JettyEmbeddedServletContainerFactoryTests
this.container = factory.getEmbeddedServletContainer();
InOrder ordered = inOrder((Object[]) configurations);
for (JettyServerCustomizer configuration : configurations) {
ordered.verify(configuration).customize((Server) anyObject());
ordered.verify(configuration).customize(any(Server.class));
}
}

View File

@@ -59,7 +59,6 @@ import org.springframework.util.SocketUtils;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.fail;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyObject;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.inOrder;
import static org.mockito.Mockito.mock;
@@ -119,7 +118,7 @@ public class TomcatEmbeddedServletContainerFactoryTests
this.container = factory.getEmbeddedServletContainer();
InOrder ordered = inOrder((Object[]) listeners);
for (LifecycleListener listener : listeners) {
ordered.verify(listener).lifecycleEvent((LifecycleEvent) anyObject());
ordered.verify(listener).lifecycleEvent(any(LifecycleEvent.class));
}
}
@@ -135,7 +134,7 @@ public class TomcatEmbeddedServletContainerFactoryTests
this.container = factory.getEmbeddedServletContainer();
InOrder ordered = inOrder((Object[]) listeners);
for (TomcatContextCustomizer listener : listeners) {
ordered.verify(listener).customize((Context) anyObject());
ordered.verify(listener).customize(any(Context.class));
}
}
@@ -151,7 +150,7 @@ public class TomcatEmbeddedServletContainerFactoryTests
this.container = factory.getEmbeddedServletContainer();
InOrder ordered = inOrder((Object[]) listeners);
for (TomcatConnectorCustomizer listener : listeners) {
ordered.verify(listener).customize((Connector) anyObject());
ordered.verify(listener).customize(any(Connector.class));
}
}