/*
 * 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 PieceTypeTest {

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

  @Test
  public void testValues() {
    for (int piecetype : PieceType.values) {
      assertThat(PieceType.values[piecetype], is(piecetype));
    }
  }

  @Test
  public void testIsValid() {
    for (int piecetype : PieceType.values) {
      assertThat(PieceType.isValid(piecetype), is(true));
    }

    assertThat(PieceType.isValid(PieceType.NOPIECETYPE), is(false));
  }

  @Test
  public void testIsValidPromotion() {
    assertThat(PieceType.isValidPromotion(PieceType.KNIGHT), is(true));
    assertThat(PieceType.isValidPromotion(PieceType.BISHOP), is(true));
    assertThat(PieceType.isValidPromotion(PieceType.ROOK), is(true));
    assertThat(PieceType.isValidPromotion(PieceType.QUEEN), is(true));
    assertThat(PieceType.isValidPromotion(PieceType.PAWN), is(false));
    assertThat(PieceType.isValidPromotion(PieceType.KING), is(false));
    assertThat(PieceType.isValidPromotion(PieceType.NOPIECETYPE), is(false));
  }

  @Test
  public void testIsSliding() {
    assertThat(PieceType.isSliding(PieceType.BISHOP), is(true));
    assertThat(PieceType.isSliding(PieceType.ROOK), is(true));
    assertThat(PieceType.isSliding(PieceType.QUEEN), is(true));
    assertThat(PieceType.isSliding(PieceType.PAWN), is(false));
    assertThat(PieceType.isSliding(PieceType.KNIGHT), is(false));
    assertThat(PieceType.isSliding(PieceType.KING), is(false));
  }

}

@@ -252,16 +252,440 @@
 ption;%0A%0A
+import static com.fluxchess.pulse.PieceType.BISHOP;%0Aimport static com.fluxchess.pulse.PieceType.KING;%0Aimport static com.fluxchess.pulse.PieceType.KNIGHT;%0Aimport static com.fluxchess.pulse.PieceType.NOPIECETYPE;%0Aimport static com.fluxchess.pulse.PieceType.PAWN;%0Aimport static com.fluxchess.pulse.PieceType.QUEEN;%0Aimport static com.fluxchess.pulse.PieceType.ROOK;%0Aimport static com.fluxchess.pulse.PieceType.isValidPromotion;%0A
 import s
@@ -1415,26 +1415,16 @@
 isValid(
-PieceType.
 NOPIECET
@@ -1504,34 +1504,24 @@
  assertThat(
-PieceType.
 isValidPromo
@@ -1525,26 +1525,16 @@
 omotion(
-PieceType.
 KNIGHT),
@@ -1556,34 +1556,24 @@
  assertThat(
-PieceType.
 isValidPromo
@@ -1577,26 +1577,16 @@
 omotion(
-PieceType.
 BISHOP),
@@ -1608,34 +1608,24 @@
  assertThat(
-PieceType.
 isValidPromo
@@ -1629,26 +1629,16 @@
 omotion(
-PieceType.
 ROOK), i
@@ -1658,34 +1658,24 @@
  assertThat(
-PieceType.
 isValidPromo
@@ -1679,26 +1679,16 @@
 omotion(
-PieceType.
 QUEEN), 
@@ -1709,34 +1709,24 @@
  assertThat(
-PieceType.
 isValidPromo
@@ -1730,26 +1730,16 @@
 omotion(
-PieceType.
 PAWN), i
@@ -1760,34 +1760,24 @@
  assertThat(
-PieceType.
 isValidPromo
@@ -1781,26 +1781,16 @@
 omotion(
-PieceType.
 KING), i
@@ -1811,34 +1811,24 @@
  assertThat(
-PieceType.
 isValidPromo
@@ -1832,26 +1832,16 @@
 omotion(
-PieceType.
 NOPIECET
@@ -1938,26 +1938,16 @@
 Sliding(
-PieceType.
 BISHOP),
@@ -1993,26 +1993,16 @@
 Sliding(
-PieceType.
 ROOK), i
@@ -2046,26 +2046,16 @@
 Sliding(
-PieceType.
 QUEEN), 
@@ -2100,26 +2100,16 @@
 Sliding(
-PieceType.
 PAWN), i
@@ -2154,26 +2154,16 @@
 Sliding(
-PieceType.
 KNIGHT),
@@ -2210,26 +2210,16 @@
 Sliding(
-PieceType.
 KING), i

Add static import in PieceTypeTest