3131import org .apache .tomcat .util .descriptor .web .FilterMap ;
3232
3333public class TestRateLimitFilterWithExactRateLimiter extends TomcatBaseTest {
34- private void testRateLimitWith1Clients (boolean exposeHeaders , boolean enforce ) throws Exception {
34+
35+ private void testRateLimitWith4Clients (boolean exposeHeaders , boolean enforce ) throws Exception {
3536
3637 int bucketRequests = 40 ;
3738 int bucketDuration = 4 ;
@@ -45,11 +46,12 @@ private void testRateLimitWith1Clients(boolean exposeHeaders, boolean enforce) t
4546
4647 Tomcat tomcat = getTomcatInstance ();
4748 Context root = tomcat .addContext ("" , TEMP_DIR );
48- tomcat .start ();
4949
5050 MockFilterChain filterChain = new MockFilterChain ();
5151 RateLimitFilter rateLimitFilter = testRateLimitFilter (filterDef , root );
5252
53+ tomcat .start ();
54+
5355 ExactRateLimiter exactRateLimiter = (ExactRateLimiter ) rateLimitFilter .rateLimiter ;
5456
5557 int allowedRequests = exactRateLimiter .getRequests ();
@@ -111,22 +113,22 @@ private void testRateLimitWith1Clients(boolean exposeHeaders, boolean enforce) t
111113
112114 @ Test
113115 public void testExposeHeaderAndReferenceRateLimitWith4Clients () throws Exception {
114- testRateLimitWith1Clients (true , false );
116+ testRateLimitWith4Clients (true , false );
115117 }
116118
117119 @ Test
118120 public void testUnexposeHeaderAndReferenceRateLimitWith4Clients () throws Exception {
119- testRateLimitWith1Clients (false , false );
121+ testRateLimitWith4Clients (false , false );
120122 }
121123
122124 @ Test
123125 public void testExposeHeaderAndEnforceRateLimitWith4Clients () throws Exception {
124- testRateLimitWith1Clients (true , true );
126+ testRateLimitWith4Clients (true , true );
125127 }
126128
127129 @ Test
128130 public void testUnexposeHeaderAndEnforceRateLimitWith4Clients () throws Exception {
129- testRateLimitWith1Clients (false , true );
131+ testRateLimitWith4Clients (false , true );
130132 }
131133
132134 private RateLimitFilter testRateLimitFilter (FilterDef filterDef , Context root ) {
0 commit comments