File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
src/test/java/io/appium/java_client/pagefactory_tests/widget/tests/combined Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change 29
29
@ SuppressWarnings ({"unchecked" , "unused" })
30
30
public class CombinedWidgetTest {
31
31
32
+ /**
33
+ * Based on how many Proxy Classes are created during this test class,
34
+ * this number is used to determine if the cache is being purged correctly between tests.
35
+ */
36
+ private static final int THRESHOLD_SIZE = 50 ;
37
+
32
38
/**
33
39
* Test data generation.
34
40
*
@@ -176,11 +182,10 @@ public List<PartiallyCombinedWidget> getWidgets() {
176
182
*/
177
183
private void assertProxyClassCacheGrowth () {
178
184
System .gc (); //Trying to force a collection for more accurate check numbers
179
- int thresholdSize = 50 ;
180
185
assertThat (
181
- "Proxy Class Cache threshold is " + thresholdSize ,
186
+ "Proxy Class Cache threshold is " + THRESHOLD_SIZE ,
182
187
getCachedProxyClassesSize (),
183
- lessThan (thresholdSize )
188
+ lessThan (THRESHOLD_SIZE )
184
189
);
185
190
}
186
191
@@ -190,7 +195,7 @@ private int getCachedProxyClassesSize() {
190
195
cpc .setAccessible (true );
191
196
Map <?, ?> cachedProxyClasses = (Map <?, ?>) cpc .get (null );
192
197
return cachedProxyClasses .size ();
193
- } catch (Exception e ) {
198
+ } catch (NoSuchFieldException | ClassNotFoundException | IllegalAccessException e ) {
194
199
throw new RuntimeException (e );
195
200
}
196
201
}
You can’t perform that action at this time.
0 commit comments