Repository: TheAlgorithms/Java
File: src/test/java/com/thealgorithms/misc/MirrorOfMatrixTest.java (Java)

Code before:
    @Test
    public void testMirrorMatrix() {
        // Test case 1: Regular matrix
        int[][] originalMatrix = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};

        int[][] expectedMirroredMatrix = {{3, 2, 1}, {6, 5, 4}, {9, 8, 7}};

        int[][] mirroredMatrix = MirrorOfMatrix.mirrorMatrix(originalMatrix);
        assertArrayEquals(expectedMirroredMatrix, mirroredMatrix);

        // Test case 2: Empty matrix
        int[][] emptyMatrix = new int[0][0];
        int[][] mirroredEmptyMatrix = MirrorOfMatrix.mirrorMatrix(emptyMatrix);
        assertArrayEquals(emptyMatrix, mirroredEmptyMatrix);

        // Test case 3: Single-row matrix
        int[][] singleRowMatrix = {{1, 2, 3}};
        int[][] expectedSingleRowMirroredMatrix = {{3, 2, 1}};
        int[][] mirroredSingleRowMatrix = MirrorOfMatrix.mirrorMatrix(singleRowMatrix);
        assertArrayEquals(expectedSingleRowMirroredMatrix, mirroredSingleRowMatrix);

        // Test case 4: Single-column matrix
        int[][] singleColumnMatrix = {{1}, {2}, {3}};
        int[][] expectedSingleColumnMirroredMatrix = {{1}, {2}, {3}};
        int[][] mirroredSingleColumnMatrix = MirrorOfMatrix.mirrorMatrix(singleColumnMatrix);
        assertArrayEquals(expectedSingleColumnMirroredMatrix, mirroredSingleColumnMatrix);
    }
}


Review comment (suggestion):
Please split it into separate methods or (even better!) use _parametrized tests_ as in [FindMaxTest](https://github.com/TheAlgorithms/Java/blob/master/src/test/java/com/thealgorithms/maths/FindMaxTest.java).

And please add test cases like _empty input_, `null` input, _input with empty rows_.

Code after:
class MirrorOfMatrixTest {

    @Test
    void testMirrorMatrixRegularMatrix() {
        int[][] originalMatrix = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};
        int[][] expectedMirrorMatrix = {{3, 2, 1}, {6, 5, 4}, {9, 8, 7}};
        int[][] mirroredMatrix = MirrorOfMatrix.mirrorMatrix(originalMatrix);
        assertArrayEquals(expectedMirrorMatrix, mirroredMatrix);
    }

    @Test
    void testMirrorMatrixEmptyMatrix() {
        int[][] originalMatrix = {};
        int[][] expectedMirrorMatrix = {};
        int[][] mirroredMatrix = MirrorOfMatrix.mirrorMatrix(originalMatrix);
        assertArrayEquals(expectedMirrorMatrix, mirroredMatrix);
    }

    @Test
    void testMirrorMatrixSingleElementMatrix() {
        int[][] originalMatrix = {{42}};
        int[][] expectedMirrorMatrix = {{42}};
        int[][] mirroredMatrix = MirrorOfMatrix.mirrorMatrix(originalMatrix);
        assertArrayEquals(expectedMirrorMatrix, mirroredMatrix);
    }

    @Test
    void testMirrorMatrixMultipleRowsOneColumnMatrix() {
        int[][] originalMatrix = {{1}, {2}, {3}, {4}};
        int[][] expectedMirrorMatrix = {{1}, {2}, {3}, {4}};
        int[][] mirroredMatrix = MirrorOfMatrix.mirrorMatrix(originalMatrix);
        assertArrayEquals(expectedMirrorMatrix, mirroredMatrix);
    }

    @Test
    void testMirrorMatrixNullInput() {
        int[][] originalMatrix = null;
        assertNull(MirrorOfMatrix.mirrorMatrix(originalMatrix));
    }

    @Test
    void testMirrotMarixThrows() {
        assertThrows(IllegalArgumentException.class, () -> MirrorOfMatrix.mirrorMatrix(new int[][] {{1}, {2, 3}}));
    }
}