|
|
|
@ -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]));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|