Skip to content
Snippets Groups Projects
Commit 673e1c91 authored by LABOUREL Arnaud's avatar LABOUREL Arnaud
Browse files

Added tests for TruchetTile

parent 208a38c8
Branches
No related tags found
No related merge requests found
package model;
public class TruchetTile implements Tile{
private final Side northWestColor;
private final Side southEastColor;
private final Side northWestSide;
private final Side southEastSide;
public TruchetTile(Side northWestColor, Side southEastColor) {
this.northWestColor = northWestColor;
this.southEastColor = southEastColor;
public TruchetTile(Side northWestSide, Side southEastSide) {
this.northWestSide = northWestSide;
this.southEastSide = southEastSide;
}
@Override
public Side side(CardinalDirection direction) {
return switch (direction){
case SOUTH, EAST -> southEastColor;
case NORTH, WEST -> northWestColor;
case SOUTH, EAST -> southEastSide;
case NORTH, WEST -> northWestSide;
};
}
}
package model;
import javafx.scene.paint.Color;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
public class TruchetTileTest {
@Test
void testGetColor(){
Tile tile = new TruchetTile(new ColoredSide(Color.BLACK), new ColoredSide(Color.RED));
assertThat(tile.side(CardinalDirection.NORTH).color()).isEqualTo(Color.BLACK);
assertThat(tile.side(CardinalDirection.EAST).color()).isEqualTo(Color.RED);
assertThat(tile.side(CardinalDirection.SOUTH).color()).isEqualTo(Color.RED);
assertThat(tile.side(CardinalDirection.WEST).color()).isEqualTo(Color.BLACK);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment