public void testKingCapture() throws ChessParseError {
  Position pos=TextIO.readFEN("8/4k3/8/8/8/8/8/4RK2 b - - 0 1");
  pos.setWhiteMove(true);
  List<String> strMoves=getMoveList(pos,false);
  assertEquals(1,strMoves.size());
  assertEquals("Re1xe7",strMoves.get(0));
  pos.setPiece(Position.getSquare(0,2),Piece.WBISHOP);
  pos.setPiece(Position.getSquare(4,1),Piece.WPAWN);
  strMoves=getMoveList(pos,false);
  assertEquals(1,strMoves.size());
  assertEquals("Ba3xe7",strMoves.get(0));
  pos.setPiece(Position.getSquare(1,3),Piece.WPAWN);
  pos.setPiece(Position.getSquare(5,5),Piece.WPAWN);
  strMoves=getMoveList(pos,false);
  assertEquals(1,strMoves.size());
  assertEquals("f6xe7",strMoves.get(0));
}

public void testKingCapture ( ) throws ChessParseError { Position pos = TextIO . readFEN ( "8/4k3/8/8/8/8/8/4RK2 b - - 0 1" ) ; pos . setWhiteMove ( true ) ; List < String > strMoves = getMoveList ( pos , false ) ; assertEquals ( 1 , strMoves . size ( ) ) ; assertEquals ( "Re1xe7" , strMoves . get ( 0 ) ) ; pos . setPiece ( Position . getSquare ( 0 , 2 ) , Piece . WBISHOP ) ; pos . setPiece ( Position . getSquare ( 4 , 1 ) , Piece . WPAWN ) ; strMoves = getMoveList ( pos , false ) ; assertEquals ( 1 , strMoves . size ( ) ) ; assertEquals ( "Ba3xe7" , strMoves . get ( 0 ) ) ; pos . setPiece ( Position . getSquare ( 1 , 3 ) , Piece . WPAWN ) ; pos . setPiece ( Position . getSquare ( 5 , 5 ) , Piece . WPAWN ) ; strMoves = getMoveList ( pos , false ) ; assertEquals ( 1 , strMoves . size ( ) ) ; assertEquals ( "f6xe7" , strMoves . get ( 0 ) ) ; }
test that if king capture is possible , only a king capture move is returned in the move list .
