File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed
spring-cloud-aws-sqs/src/test/java/io/awspring/cloud/sqs/listener Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change
1
+ package io .awspring .cloud .sqs .listener ;
2
+
3
+ import org .junit .jupiter .api .BeforeEach ;
4
+ import org .junit .jupiter .api .Test ;
5
+
6
+ import static org .assertj .core .api .Assertions .assertThat ;
7
+
8
+ class FullBatchBackPressureHandlerTest {
9
+
10
+ private FullBatchBackPressureHandler handler ;
11
+
12
+ private final int batchSize = 10 ;
13
+
14
+ @ BeforeEach
15
+ void setUp () {
16
+ handler = FullBatchBackPressureHandler .builder ()
17
+ .batchSize (batchSize )
18
+ .build ();
19
+ }
20
+
21
+ @ Test
22
+ void request_withExactBatchSize_shouldReturnBatchSize () throws InterruptedException {
23
+ assertThat (handler .request (batchSize )).isEqualTo (batchSize );
24
+ }
25
+
26
+ @ Test
27
+ void request_withNonBatchSize_shouldReturnZero () throws InterruptedException {
28
+ int permits = handler .request (batchSize - 1 );
29
+ assertThat (permits ).isZero ();
30
+ permits = handler .request (batchSize + 1 );
31
+ assertThat (permits ).isZero ();
32
+ }
33
+
34
+ @ Test
35
+ void requestBatch_shouldReturnBatchSize () throws InterruptedException {
36
+ assertThat (handler .requestBatch ()).isEqualTo (batchSize );
37
+ }
38
+ }
39
+
You can’t perform that action at this time.
0 commit comments