Skip to content

Commit c713dbc

Browse files
authored
Merge pull request iluwatar#752 from christophercolumbusdog/master
iluwatar#643 Fix flaky tests for throttling pattern
2 parents d7893c1 + f3e1cd3 commit c713dbc

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

throttling/src/test/java/com/iluwatar/throttling/B2BServiceTest.java

+4-6
Original file line numberDiff line numberDiff line change
@@ -22,29 +22,27 @@
2222
*/
2323
package com.iluwatar.throttling;
2424

25-
import com.iluwatar.throttling.timer.ThrottleTimerImpl;
2625
import com.iluwatar.throttling.timer.Throttler;
27-
import org.junit.jupiter.api.Disabled;
2826
import org.junit.jupiter.api.Test;
2927

30-
import static org.junit.jupiter.api.Assertions.assertTrue;
28+
import static org.junit.jupiter.api.Assertions.assertEquals;
3129

3230
/**
3331
* B2BServiceTest class to test the B2BService
3432
*/
3533
public class B2BServiceTest {
3634

37-
@Disabled
3835
@Test
3936
public void dummyCustomerApiTest() {
4037
Tenant tenant = new Tenant("testTenant", 2);
41-
Throttler timer = new ThrottleTimerImpl(100);
38+
// In order to assure that throttling limits will not be reset, we use an empty throttling implementation
39+
Throttler timer = () -> { };
4240
B2BService service = new B2BService(timer);
4341

4442
for (int i = 0; i < 5; i++) {
4543
service.dummyCustomerApi(tenant);
4644
}
4745
long counter = CallsCount.getCount(tenant.getName());
48-
assertTrue(counter == 2, "Counter limit must be reached");
46+
assertEquals(2, counter, "Counter limit must be reached");
4947
}
5048
}

0 commit comments

Comments
 (0)