Switch anonymous inner classes to lambdas

See gh-33987
This commit is contained in:
Krzysztof Krason 2023-01-26 18:28:13 -08:00 committed by Phillip Webb
parent 888d4ac392
commit a8958471f6
3 changed files with 6 additions and 28 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 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.
@ -16,8 +16,6 @@
package org.springframework.boot.test.mock.mockito;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import org.junit.jupiter.api.Test;
@ -60,14 +58,7 @@ class SpyBeanWithJdkProxyTests {
@Bean
ExampleRepository dateService() {
return (ExampleRepository) Proxy.newProxyInstance(getClass().getClassLoader(),
new Class<?>[] { ExampleRepository.class }, new InvocationHandler() {
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
return new Example((String) args[0]);
}
});
new Class<?>[] { ExampleRepository.class }, (proxy, method, args) -> new Example((String) args[0]));
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2023 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.
@ -30,14 +30,7 @@ public class SampleFlywayApplication {
@Bean
public CommandLineRunner runner(PersonRepository repository) {
return new CommandLineRunner() {
@Override
public void run(String... args) throws Exception {
System.err.println(repository.findAll());
}
};
return (args) -> System.err.println(repository.findAll());
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 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.
@ -19,7 +19,6 @@ package smoketest.jersey;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import org.glassfish.jersey.server.ResourceConfig;
import org.junit.jupiter.api.Test;
import smoketest.jersey.AbstractJerseyManagementPortTests.ResourceConfigConfiguration;
@ -90,12 +89,7 @@ class AbstractJerseyManagementPortTests {
@Bean
ResourceConfigCustomizer customizer() {
return new ResourceConfigCustomizer() {
@Override
public void customize(ResourceConfig config) {
config.register(TestEndpoint.class);
}
};
return (config) -> config.register(TestEndpoint.class);
}
@Path("/test")