Skip to content

Commit e92d433

Browse files
updated with Junit and line formating
1 parent 7f4ca96 commit e92d433

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/test/java/com/thealgorithms/slidingwindow/MinSumKSizeSubarrayTest.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
package com.thealgorithms.slidingwindow;
2+
23
import static org.junit.jupiter.api.Assertions.assertEquals;
4+
35
import org.junit.jupiter.api.Test;
6+
47
/**
58
* Unit tests for the MinSumKSizeSubarray class.
6-
*
9+
*
710
* @author Rashi Dashore (https://github.com/rashi07dashore)
811
*/
912
class MinSumKSizeSubarrayTest {
13+
1014
/**
1115
* Test for the basic case of finding the minimum sum.
1216
*/
@@ -17,6 +21,7 @@ void testMinSumKSizeSubarray() {
1721
int expectedMinSum = 3; // 1 + 1 + 1
1822
assertEquals(expectedMinSum, MinSumKSizeSubarray.minSumKSizeSubarray(arr, k));
1923
}
24+
2025
/**
2126
* Test for a different array and subarray size.
2227
*/
@@ -27,6 +32,7 @@ void testMinSumKSizeSubarrayWithDifferentValues() {
2732
int expectedMinSum = 3; // 1 + 2
2833
assertEquals(expectedMinSum, MinSumKSizeSubarray.minSumKSizeSubarray(arr, k));
2934
}
35+
3036
/**
3137
* Test for edge case with insufficient elements.
3238
*/
@@ -37,6 +43,7 @@ void testMinSumKSizeSubarrayWithInsufficientElements() {
3743
int expectedMinSum = -1; // Edge case
3844
assertEquals(expectedMinSum, MinSumKSizeSubarray.minSumKSizeSubarray(arr, k));
3945
}
46+
4047
/**
4148
* Test for large array.
4249
*/
@@ -47,6 +54,7 @@ void testMinSumKSizeSubarrayWithLargeArray() {
4754
int expectedMinSum = -10; // -1 + -2 + -3 + -4 + 0
4855
assertEquals(expectedMinSum, MinSumKSizeSubarray.minSumKSizeSubarray(arr, k));
4956
}
57+
5058
/**
5159
* Test for array with negative numbers.
5260
*/
@@ -57,6 +65,7 @@ void testMinSumKSizeSubarrayWithNegativeNumbers() {
5765
int expectedMinSum = -9; // -4 + -5
5866
assertEquals(expectedMinSum, MinSumKSizeSubarray.minSumKSizeSubarray(arr, k));
5967
}
68+
6069
/**
6170
* Test for the case where k equals the array length.
6271
*/

0 commit comments

Comments
 (0)