コード例 #1
0
 @Test
 public void testCurrentMoveWhenNextMoveIsX() throws Exception {
   final CurrentMoveController currentMoveController = new CurrentMoveController();
   for (int i = 0; i < 3; i++) {
     final Field field = new Field(3);
     field.setFigure(new Point(i, 1), Figure.O);
     field.setFigure(new Point(i, 2), Figure.X);
     assertEquals(Figure.X, currentMoveController.currentMove(field));
   }
 }
コード例 #2
0
 @Test
 public void testCurrentMoveWhenNoMove() throws Exception {
   final CurrentMoveController currentMoveController = new CurrentMoveController();
   for (int i = 0; i < 3; i++) {
     final Field field = new Field(3);
     field.setFigure(new Point(0, 0), Figure.O);
     field.setFigure(new Point(0, 1), Figure.X);
     field.setFigure(new Point(0, 2), Figure.O);
     field.setFigure(new Point(1, 0), Figure.O);
     field.setFigure(new Point(1, 1), Figure.X);
     field.setFigure(new Point(1, 2), Figure.O);
     field.setFigure(new Point(2, 0), Figure.O);
     field.setFigure(new Point(2, 1), Figure.X);
     field.setFigure(new Point(2, 2), Figure.O);
     assertNull(currentMoveController.currentMove(field));
   }
 }