Browse Source

Merge branch 'Figure' into Game

AIPlayer
Jonas Wagner 3 years ago
parent
commit
bcc944f300
  1. 9
      src/main/java/Figure.java
  2. 8
      src/main/java/Player.java
  3. 13
      src/test/java/PlayerTest.java

9
src/main/java/Figure.java

@ -0,0 +1,9 @@
public class Figure {
int position;
public Figure() {
this.position = -1;
}
}

8
src/main/java/Player.java

@ -1,9 +1,17 @@
import javax.sound.midi.Soundbank;
import java.util.Arrays;
public class Player { public class Player {
String name; String name;
Figure[] figures;
public Player (String name) { public Player (String name) {
this.name = name; this.name = name;
figures = new Figure[4];
for(int i = 0; i < 4; i++) {
this.figures[i] = new Figure();
}
} }
@Override @Override

13
src/test/java/PlayerTest.java

@ -29,5 +29,18 @@ public class PlayerTest {
assertThat(calculatedResult).describedAs("Player Name").isEqualTo(expectedResult); assertThat(calculatedResult).describedAs("Player Name").isEqualTo(expectedResult);
} }
@Test
void checkStartPositionOfFigures() {
int expectedResult = -1;
int calculatedResult = p.figures[0].position;
for(int i = 0; i < 4; i++) {
calculatedResult = p.figures[i].position;
if(expectedResult != calculatedResult) {
calculatedResult = 1;
break;
}
}
assertThat(calculatedResult).describedAs("Starting postion of Figures").isEqualTo(expectedResult);
}
} }
Loading…
Cancel
Save