Skip to content

Commit 204e5ca

Browse files
authored
Update MatrixRowPermutationTest.java
1 parent 0f4d71a commit 204e5ca

File tree

1 file changed

+5
-14
lines changed

1 file changed

+5
-14
lines changed

src/test/java/com/thealgorithms/matrix/MatrixRowPermutationTest.java

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,16 @@
44
import static org.junit.jupiter.api.Assertions.assertThrows;
55
import static org.junit.jupiter.api.Assertions.assertTrue;
66

7-
import java.util.List;
87
import java.util.Arrays;
8+
import java.util.List;
99

1010
import org.junit.jupiter.api.Test;
1111

1212
public class MatrixRowPermutationTest {
1313

1414
@Test
1515
void testPermute2x2Matrix() {
16-
int[][] matrix = {
17-
{1, 2},
18-
{3, 4}
19-
};
16+
int[][] matrix = {{1, 2}, {3, 4}};
2017

2118
List<int[][]> permutations = MatrixRowPermutation.permuteRows(matrix);
2219
assertEquals(2, permutations.size(), "Expected 2 permutations for 2x2 matrix");
@@ -28,7 +25,7 @@ void testPermute2x2Matrix() {
2825
for (int[][] perm : permutations) {
2926
if (Arrays.deepEquals(perm, matrix)) {
3027
foundOriginal = true;
31-
} else if (Arrays.deepEquals(perm, new int[][]{{3, 4}, {1, 2}})) {
28+
} else if (Arrays.deepEquals(perm, new int[][] {{3, 4}, {1, 2}})) {
3229
foundSwapped = true;
3330
}
3431
}
@@ -39,11 +36,7 @@ void testPermute2x2Matrix() {
3936

4037
@Test
4138
void testPermute3x1Matrix() {
42-
int[][] matrix = {
43-
{1},
44-
{2},
45-
{3}
46-
};
39+
int[][] matrix = {{1}, {2}, {3}};
4740

4841
List<int[][]> permutations = MatrixRowPermutation.permuteRows(matrix);
4942
assertEquals(6, permutations.size(), "Expected 6 permutations for 3x1 matrix");
@@ -62,9 +55,7 @@ void testNullMatrixThrowsException() {
6255

6356
@Test
6457
void testSingleRowMatrix() {
65-
int[][] matrix = {
66-
{42, 99}
67-
};
58+
int[][] matrix = {{42, 99}};
6859

6960
List<int[][]> permutations = MatrixRowPermutation.permuteRows(matrix);
7061
assertEquals(1, permutations.size(), "Expected 1 permutation for single-row matrix");

0 commit comments

Comments
 (0)