/*
 * Copyright (C) 2014 Pedro Vicente Gómez Sánchez.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.github.pedrovgs.problem54;

import org.junit.Before;
import org.junit.Test;

import static org.junit.Assert.assertArrayEquals;

/**
 * @author Pedro Vicente Gómez Sánchez.
 */
public class RotateMatrixTest {

  private RotateMatrix rotateMatrix;

  @Before public void setUp() {
    rotateMatrix = new RotateMatrix();
  }

  @Test(expected = IllegalArgumentException.class) public void shouldNotAcceptNullMatrix() {
    rotateMatrix.rotate(null);
  }

  @Test(expected = IllegalArgumentException.class)
  public void shouldNotAcceptMatrixWithDifferentHeightAndWidth() {
    int[][] matrix = new int[6][3];

    rotateMatrix.rotate(matrix);
  }

  @Test(expected = IllegalArgumentException.class) public void shouldNotAcceptAnEmtpyMatrix() {
    int[][] matrix = new int[0][0];

    rotateMatrix.rotate(matrix);
  }

  @Test public void shouldRotateMatrix() {
    int[][] matrix = { { 0, 1, 2 }, { 3, 4, 5 }, { 6, 7, 8 } };

    rotateMatrix.rotate(matrix);

    int[][] expectedResult = { { 6, 3, 0 }, { 7, 4, 1 }, { 8, 5, 2 } };
    assertArrayEquals(expectedResult, matrix);
  }
}

Add some tests to problem 54
Add some tests to problem 54
