1
1
/*
2
- * Copyright 2002-2023 the original author or authors.
2
+ * Copyright 2002-2024 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -55,19 +55,16 @@ void testProxyAssignable() {
55
55
DefaultListableBeanFactory bf = new DefaultListableBeanFactory ();
56
56
new XmlBeanDefinitionReader (bf ).loadBeanDefinitions (MAP_CONTEXT );
57
57
Object baseMap = bf .getBean ("singletonMap" );
58
- boolean condition = baseMap instanceof Map ;
59
- assertThat (condition ).isTrue ();
58
+ assertThat (baseMap instanceof Map ).isTrue ();
60
59
}
61
60
62
61
@ Test
63
62
void testSimpleProxy () {
64
63
DefaultListableBeanFactory bf = new DefaultListableBeanFactory ();
65
64
new XmlBeanDefinitionReader (bf ).loadBeanDefinitions (MAP_CONTEXT );
66
65
Object simpleMap = bf .getBean ("simpleMap" );
67
- boolean condition1 = simpleMap instanceof Map ;
68
- assertThat (condition1 ).isTrue ();
69
- boolean condition = simpleMap instanceof HashMap ;
70
- assertThat (condition ).isTrue ();
66
+ assertThat (simpleMap instanceof Map ).isTrue ();
67
+ assertThat (simpleMap instanceof HashMap ).isTrue ();
71
68
}
72
69
73
70
@ Test
@@ -97,8 +94,7 @@ void testJdkScopedProxy() throws Exception {
97
94
ITestBean bean = (ITestBean ) bf .getBean ("testBean" );
98
95
assertThat (bean ).isNotNull ();
99
96
assertThat (AopUtils .isJdkDynamicProxy (bean )).isTrue ();
100
- boolean condition1 = bean instanceof ScopedObject ;
101
- assertThat (condition1 ).isTrue ();
97
+ assertThat (bean instanceof ScopedObject ).isTrue ();
102
98
ScopedObject scoped = (ScopedObject ) bean ;
103
99
assertThat (scoped .getTargetObject ().getClass ()).isEqualTo (TestBean .class );
104
100
bean .setAge (101 );
@@ -110,8 +106,7 @@ void testJdkScopedProxy() throws Exception {
110
106
assertThat (deserialized ).isNotNull ();
111
107
assertThat (AopUtils .isJdkDynamicProxy (deserialized )).isTrue ();
112
108
assertThat (bean .getAge ()).isEqualTo (101 );
113
- boolean condition = deserialized instanceof ScopedObject ;
114
- assertThat (condition ).isTrue ();
109
+ assertThat (deserialized instanceof ScopedObject ).isTrue ();
115
110
ScopedObject scopedDeserialized = (ScopedObject ) deserialized ;
116
111
assertThat (scopedDeserialized .getTargetObject ().getClass ()).isEqualTo (TestBean .class );
117
112
@@ -128,8 +123,7 @@ void testCglibScopedProxy() throws Exception {
128
123
129
124
TestBean tb = (TestBean ) bf .getBean ("testBean" );
130
125
assertThat (AopUtils .isCglibProxy (tb .getFriends ())).isTrue ();
131
- boolean condition1 = tb .getFriends () instanceof ScopedObject ;
132
- assertThat (condition1 ).isTrue ();
126
+ assertThat (tb .getFriends () instanceof ScopedObject ).isTrue ();
133
127
ScopedObject scoped = (ScopedObject ) tb .getFriends ();
134
128
assertThat (scoped .getTargetObject ().getClass ()).isEqualTo (ArrayList .class );
135
129
tb .getFriends ().add ("myFriend" );
@@ -141,8 +135,7 @@ void testCglibScopedProxy() throws Exception {
141
135
assertThat (deserialized ).isNotNull ();
142
136
assertThat (AopUtils .isCglibProxy (deserialized )).isTrue ();
143
137
assertThat (deserialized ).contains ("myFriend" );
144
- boolean condition = deserialized instanceof ScopedObject ;
145
- assertThat (condition ).isTrue ();
138
+ assertThat (deserialized instanceof ScopedObject ).isTrue ();
146
139
ScopedObject scopedDeserialized = (ScopedObject ) deserialized ;
147
140
assertThat (scopedDeserialized .getTargetObject ().getClass ()).isEqualTo (ArrayList .class );
148
141
0 commit comments