/*
 * Copyright (C) 2013-2014 Phokham Nonava
 *
 * Use of this source code is governed by the MIT license that can be
 * found in the LICENSE file.
 */
package com.fluxchess.pulse;

import org.junit.Test;

import java.lang.reflect.InvocationTargetException;

import static com.fluxchess.test.AssertUtil.assertUtilityClassWellDefined;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;

public class MoveTest {

  @Test
  public void testUtilityClass()
      throws InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessException {
    assertUtilityClassWellDefined(Move.class);
  }

  @Test
  public void testCreation() {
    int move = Move.valueOf(MoveType.PAWNPROMOTION, Square.a7, Square.b8, Piece.WHITE_PAWN, Piece.BLACK_QUEEN, PieceType.KNIGHT);

    assertThat(Move.getType(move), is(MoveType.PAWNPROMOTION));
    assertThat(Move.getOriginSquare(move), is(Square.a7));
    assertThat(Move.getTargetSquare(move), is(Square.b8));
    assertThat(Move.getOriginPiece(move), is(Piece.WHITE_PAWN));
    assertThat(Move.getTargetPiece(move), is(Piece.BLACK_QUEEN));
    assertThat(Move.getPromotion(move), is(PieceType.KNIGHT));
  }

  @Test
  public void testPromotion() {
    int move = Move.valueOf(MoveType.PAWNPROMOTION, Square.b7, Square.c8, Piece.WHITE_PAWN, Piece.BLACK_QUEEN, PieceType.KNIGHT);

    assertThat(Move.getPromotion(move), is(PieceType.KNIGHT));
  }

}

@@ -252,16 +252,411 @@
 ption;%0A%0A
+import static com.fluxchess.pulse.MoveType.PAWNPROMOTION;%0Aimport static com.fluxchess.pulse.Piece.BLACK_QUEEN;%0Aimport static com.fluxchess.pulse.Piece.WHITE_PAWN;%0Aimport static com.fluxchess.pulse.PieceType.KNIGHT;%0Aimport static com.fluxchess.pulse.Square.a7;%0Aimport static com.fluxchess.pulse.Square.b7;%0Aimport static com.fluxchess.pulse.Square.b8;%0Aimport static com.fluxchess.pulse.Square.c8;%0A
 import s
@@ -1103,33 +1103,24 @@
 ove.valueOf(
-MoveType.
 PAWNPROMOTIO
@@ -1126,36 +1126,16 @@
 ON, 
-Square.a7, Square.b8, Piece.
+a7, b8, 
 WHIT
@@ -1134,38 +1134,32 @@
 b8, WHITE_PAWN, 
-Piece.
 BLACK_QUEEN, Pie
@@ -1151,34 +1151,24 @@
 LACK_QUEEN, 
-PieceType.
 KNIGHT);%0A%0A  
@@ -1203,25 +1203,16 @@
 ve), is(
-MoveType.
 PAWNPROM
@@ -1266,23 +1266,16 @@
 ve), is(
-Square.
 a7));%0A  
@@ -1318,23 +1318,16 @@
 ve), is(
-Square.
 b8));%0A  
@@ -1369,22 +1369,16 @@
 ve), is(
-Piece.
 WHITE_PA
@@ -1428,22 +1428,16 @@
 ve), is(
-Piece.
 BLACK_QU
@@ -1482,34 +1482,24 @@
 n(move), is(
-PieceType.
 KNIGHT));%0A  
@@ -1569,25 +1569,16 @@
 valueOf(
-MoveType.
 PAWNPROM
@@ -1588,36 +1588,16 @@
 ON, 
-Square.b7, Square.c8, Piece.
+b7, c8, 
 WHIT
@@ -1604,22 +1604,16 @@
 E_PAWN, 
-Piece.
 BLACK_QU
@@ -1617,26 +1617,16 @@
 _QUEEN, 
-PieceType.
 KNIGHT);
@@ -1670,26 +1670,16 @@
 ve), is(
-PieceType.
 KNIGHT))

Add static import in MoveTest