1
1
package com .thealgorithms .slidingwindow ;
2
2
3
3
import static org .junit .jupiter .api .Assertions .assertEquals ;
4
+
4
5
import org .junit .jupiter .api .Test ;
5
6
6
7
/**
@@ -40,7 +41,7 @@ void testMaxSumKSizeSubarrayWithInsufficientElements() {
40
41
int [] arr = {1 , 2 };
41
42
int k = 3 ; // Not enough elements
42
43
int expectedMaxSum = -1 ; // Edge case
43
- assertEquals (expectedMaxSum , SlidingWindow .maxSumKSizeSubarray (arr , k ));
44
+ assertEquals (expectedMaxSum , SlidingWindow .maxSumKSizeSubarray (arr , k ));
44
45
}
45
46
46
47
/**
@@ -62,7 +63,7 @@ void testMaxSumKSizeSubarrayWithNegativeNumbers() {
62
63
int [] arr = {-1 , -2 , -3 , -4 , -5 };
63
64
int k = 2 ;
64
65
int expectedMaxSum = -3 ; // -1 + -2
65
- assertEquals (expectedMaxSum , SlidingWindow .maxSumKSizeSubarray (arr , k ));
66
+ assertEquals (expectedMaxSum , SlidingWindow .maxSumKSizeSubarray (arr , k ));
66
67
}
67
68
68
69
/**
@@ -73,6 +74,6 @@ void testMaxSumKSizeSubarrayWithKEqualToArrayLength() {
73
74
int [] arr = {1 , 2 , 3 , 4 , 5 };
74
75
int k = 5 ;
75
76
int expectedMaxSum = 15 ; // 1 + 2 + 3 + 4 + 5
76
- assertEquals (expectedMaxSum , SlidingWindow .maxSumKSizeSubarray (arr , k ));
77
+ assertEquals (expectedMaxSum , SlidingWindow .maxSumKSizeSubarray (arr , k ));
77
78
}
78
79
}
0 commit comments