Browse Source

4gewinnt: refactored attributs and test methods

4gewinnt
Steffen Helmke 3 years ago
committed by Lorenz Hohmann
parent
commit
97c66b727e
  1. 6
      src/main/java/de/tims/viergewinnt/ai/Logic.java
  2. 12
      src/test/java/de/tims/viergewinnt/ai/LogicTest.java

6
src/main/java/de/tims/viergewinnt/ai/Logic.java

@ -13,9 +13,9 @@ import javax.swing.JPanel;
public class Logic {
int[][] board = new int[6][6];
int currentPlayer = 1;
int player1Score = 0;
private int[][] board = new int[6][6];
private int currentPlayer = 1;
private int player1Score = 0;
public void setField(int player, int row, int column) {
board[row][column] = player;

12
src/test/java/de/tims/viergewinnt/ai/LogicTest.java

@ -56,7 +56,7 @@ class LogicTest {
testObj.setCurrentPlayer(player);
testObj.playChip(column);
int realResult = testObj.currentPlayer;
int realResult = testObj.getCurrentPlayer();
assertEquals(expectedResult, realResult);
}
@ -70,7 +70,7 @@ class LogicTest {
testObj.setCurrentPlayer(player);
testObj.playChip(column);
int realResult = testObj.currentPlayer;
int realResult = testObj.getCurrentPlayer();
assertEquals(expectedResult, realResult);
}
@ -97,7 +97,7 @@ class LogicTest {
testObj.setField(player, row, column);
assertEquals(1, testObj.board[row][column]);
assertEquals(1, testObj.getField(row, column));
}
@Test
@ -108,7 +108,7 @@ class LogicTest {
testObj.setField(player, row, column);
assertEquals(player, testObj.board[row][column]);
assertEquals(player, testObj.getField(row, column));
}
@Test
@ -129,7 +129,7 @@ class LogicTest {
testObj.setCurrentPlayer(player);
assertEquals(player, testObj.currentPlayer);
assertEquals(player, testObj.getCurrentPlayer());
}
@Test
@ -147,7 +147,7 @@ class LogicTest {
int expectedResult = 500;
testObj.setPlayer1Score(expectedResult);
assertEquals(expectedResult, testObj.player1Score);
assertEquals(expectedResult, testObj.getPlayer1Score());
}
@Test

Loading…
Cancel
Save