Commit 42cb053d authored by Andy Wilkinson's avatar Andy Wilkinson

Replace and remove deprecated API usage

parent f2df6e80
/* /*
* 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"); * 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.
...@@ -34,7 +34,6 @@ import org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration; ...@@ -34,7 +34,6 @@ import org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration;
import org.springframework.boot.autoconfigure.liquibase.LiquibaseAutoConfiguration; import org.springframework.boot.autoconfigure.liquibase.LiquibaseAutoConfiguration;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Import; import org.springframework.context.annotation.Import;
import org.springframework.lang.UsesJava8;
// Flyway must go first // Flyway must go first
@SpringBootApplication @SpringBootApplication
...@@ -66,7 +65,6 @@ public class SpringBootHypermediaApplication implements CommandLineRunner { ...@@ -66,7 +65,6 @@ public class SpringBootHypermediaApplication implements CommandLineRunner {
createEvent("2016-11-01T12:00:00Z", "admin", "AUTHENTICATION_SUCCESS")); createEvent("2016-11-01T12:00:00Z", "admin", "AUTHENTICATION_SUCCESS"));
} }
@UsesJava8
private AuditEvent createEvent(String instant, String principal, String type) { private AuditEvent createEvent(String instant, String principal, String type) {
return new AuditEvent(Date.from(Instant.parse(instant)), principal, type, return new AuditEvent(Date.from(Instant.parse(instant)), principal, type,
Collections.<String, Object>emptyMap()); Collections.<String, Object>emptyMap());
......
...@@ -76,7 +76,7 @@ public class MessageInterpolatorFactory implements ObjectFactory<MessageInterpol ...@@ -76,7 +76,7 @@ public class MessageInterpolatorFactory implements ObjectFactory<MessageInterpol
private MessageInterpolator getFallback(String fallback) { private MessageInterpolator getFallback(String fallback) {
Class<?> interpolatorClass = ClassUtils.resolveClassName(fallback, null); Class<?> interpolatorClass = ClassUtils.resolveClassName(fallback, null);
Object interpolator = BeanUtils.instantiate(interpolatorClass); Object interpolator = BeanUtils.instantiateClass(interpolatorClass);
return (MessageInterpolator) interpolator; return (MessageInterpolator) interpolator;
} }
......
/* /*
* 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"); * 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.
...@@ -51,7 +51,7 @@ import org.springframework.boot.web.servlet.ServletRegistrationBean; ...@@ -51,7 +51,7 @@ import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.http.HttpHeaders; import org.springframework.http.HttpHeaders;
import static org.assertj.core.api.Assertions.assertThat; 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.inOrder;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
...@@ -84,7 +84,7 @@ public class JettyEmbeddedServletContainerFactoryTests ...@@ -84,7 +84,7 @@ public class JettyEmbeddedServletContainerFactoryTests
this.container = factory.getEmbeddedServletContainer(); this.container = factory.getEmbeddedServletContainer();
InOrder ordered = inOrder((Object[]) configurations); InOrder ordered = inOrder((Object[]) configurations);
for (Configuration configuration : 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 ...@@ -100,7 +100,7 @@ public class JettyEmbeddedServletContainerFactoryTests
this.container = factory.getEmbeddedServletContainer(); this.container = factory.getEmbeddedServletContainer();
InOrder ordered = inOrder((Object[]) configurations); InOrder ordered = inOrder((Object[]) configurations);
for (JettyServerCustomizer configuration : configurations) { for (JettyServerCustomizer configuration : configurations) {
ordered.verify(configuration).customize((Server) anyObject()); ordered.verify(configuration).customize(any(Server.class));
} }
} }
......
...@@ -59,7 +59,6 @@ import org.springframework.util.SocketUtils; ...@@ -59,7 +59,6 @@ import org.springframework.util.SocketUtils;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyObject;
import static org.mockito.BDDMockito.given; import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.inOrder; import static org.mockito.Mockito.inOrder;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
...@@ -119,7 +118,7 @@ public class TomcatEmbeddedServletContainerFactoryTests ...@@ -119,7 +118,7 @@ public class TomcatEmbeddedServletContainerFactoryTests
this.container = factory.getEmbeddedServletContainer(); this.container = factory.getEmbeddedServletContainer();
InOrder ordered = inOrder((Object[]) listeners); InOrder ordered = inOrder((Object[]) listeners);
for (LifecycleListener listener : 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 ...@@ -135,7 +134,7 @@ public class TomcatEmbeddedServletContainerFactoryTests
this.container = factory.getEmbeddedServletContainer(); this.container = factory.getEmbeddedServletContainer();
InOrder ordered = inOrder((Object[]) listeners); InOrder ordered = inOrder((Object[]) listeners);
for (TomcatContextCustomizer listener : 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 ...@@ -151,7 +150,7 @@ public class TomcatEmbeddedServletContainerFactoryTests
this.container = factory.getEmbeddedServletContainer(); this.container = factory.getEmbeddedServletContainer();
InOrder ordered = inOrder((Object[]) listeners); InOrder ordered = inOrder((Object[]) listeners);
for (TomcatConnectorCustomizer listener : listeners) { for (TomcatConnectorCustomizer listener : listeners) {
ordered.verify(listener).customize((Connector) anyObject()); ordered.verify(listener).customize(any(Connector.class));
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment