You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.3 KiB
46 lines
1.3 KiB
import static org.assertj.core.api.Assertions.*;
|
|
|
|
import org.junit.jupiter.api.BeforeEach;
|
|
import org.junit.jupiter.api.DisplayName;
|
|
import org.junit.jupiter.api.Test;
|
|
import org.junit.jupiter.params.ParameterizedTest;
|
|
import org.junit.jupiter.params.provider.Arguments;
|
|
import org.junit.jupiter.params.provider.MethodSource;
|
|
|
|
public class PlayerTest {
|
|
|
|
private Player p;
|
|
|
|
@BeforeEach
|
|
void setup() {
|
|
p = new Player("Rot");
|
|
}
|
|
|
|
@Test
|
|
void testDice() {
|
|
int calculatedResult = p.rollDice();
|
|
assertThat(calculatedResult).describedAs("Dice result").isBetween(1,6);
|
|
}
|
|
|
|
@Test
|
|
void testToString() {
|
|
String expectedResult = "Rot";
|
|
String calculatedResult = p.toString();
|
|
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);
|
|
}
|
|
|
|
}
|