3
3
import org .junit .jupiter .api .Test ;
4
4
import org .springframework .core .ResolvableType ;
5
5
6
+ import java .util .UUID ;
6
7
import java .util .function .Supplier ;
7
8
8
9
import static org .assertj .core .api .Assertions .assertThat ;
@@ -16,8 +17,8 @@ class ScopedProxyGenericTypeMatchTests {
16
17
void scopedProxyBeanTypeMatching () {
17
18
DefaultListableBeanFactory factory = new DefaultListableBeanFactory ();
18
19
19
- String targetBeanName = "scopedTarget. wordBean" ;
20
- String proxyBeanName = "wordBean" ;
20
+ String proxyBeanName = "wordBean-" + UUID . randomUUID () ;
21
+ String targetBeanName = "scopedTarget." + proxyBeanName ;
21
22
22
23
RootBeanDefinition targetDef = new RootBeanDefinition (SomeGenericSupplier .class );
23
24
targetDef .setScope ("request" );
@@ -31,11 +32,9 @@ void scopedProxyBeanTypeMatching() {
31
32
32
33
ResolvableType supplierType = ResolvableType .forClassWithGenerics (Supplier .class , String .class );
33
34
34
- boolean isMatch = factory .isTypeMatch (proxyBeanName , supplierType );
35
- assertThat (isMatch ).isTrue ();
35
+ assertThat (factory .isTypeMatch (proxyBeanName , supplierType )).isTrue ();
36
36
37
- String [] names = factory .getBeanNamesForType (supplierType );
38
- assertThat (names ).contains (proxyBeanName );
37
+ assertThat (factory .getBeanNamesForType (supplierType )).contains (proxyBeanName );
39
38
}
40
39
41
40
static class SomeGenericSupplier implements Supplier <String > {
0 commit comments