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 2929@ SuppressWarnings ({"unchecked" , "unused" })
3030public class CombinedWidgetTest {
3131
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+
3238 /**
3339 * Test data generation.
3440 *
@@ -176,11 +182,10 @@ public List<PartiallyCombinedWidget> getWidgets() {
176182 */
177183 private void assertProxyClassCacheGrowth () {
178184 System .gc (); //Trying to force a collection for more accurate check numbers
179- int thresholdSize = 50 ;
180185 assertThat (
181- "Proxy Class Cache threshold is " + thresholdSize ,
186+ "Proxy Class Cache threshold is " + THRESHOLD_SIZE ,
182187 getCachedProxyClassesSize (),
183- lessThan (thresholdSize )
188+ lessThan (THRESHOLD_SIZE )
184189 );
185190 }
186191
@@ -190,7 +195,7 @@ private int getCachedProxyClassesSize() {
190195 cpc .setAccessible (true );
191196 Map <?, ?> cachedProxyClasses = (Map <?, ?>) cpc .get (null );
192197 return cachedProxyClasses .size ();
193- } catch (Exception e ) {
198+ } catch (NoSuchFieldException | ClassNotFoundException | IllegalAccessException e ) {
194199 throw new RuntimeException (e );
195200 }
196201 }
You can’t perform that action at this time.
0 commit comments