64 lines
1.3 KiB
Java
64 lines
1.3 KiB
Java
package Server;
|
|
|
|
import org.junit.jupiter.api.BeforeEach;
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
import java.util.List;
|
|
|
|
import static org.junit.jupiter.api.Assertions.*;
|
|
|
|
class OfferingTileTest {
|
|
|
|
OfferingTile offeringTile;
|
|
|
|
@Test
|
|
void isEmpty() {
|
|
|
|
//test the ability of the method to recognize an occupied tile
|
|
|
|
OfferingTile offeringTile = new OfferingTile(4);
|
|
|
|
assertTrue(offeringTile.isEmpty());
|
|
|
|
}
|
|
|
|
@BeforeEach
|
|
public void init(){
|
|
offeringTile = new OfferingTile(4);
|
|
offeringTile.setOccupant(new Player("Johnny", TotemColor.BLUE));
|
|
}
|
|
@Test
|
|
void RemoveOccupant(){
|
|
|
|
//test that the occupant has been removed
|
|
|
|
assertNull(offeringTile.removeOccupant());
|
|
}
|
|
|
|
@Test
|
|
void GetOccupant(){
|
|
|
|
assertEquals("Johnny",offeringTile.getOccupant().getNickname());
|
|
}
|
|
|
|
@Test
|
|
void SetOccupant(){
|
|
|
|
//test that the player has been set
|
|
|
|
|
|
assertEquals("Johnny",offeringTile.getOccupant().getNickname());
|
|
}
|
|
|
|
@Test
|
|
void getActions(){
|
|
|
|
//tests that the actions associated to tile are the correct ones
|
|
OfferingTile offeringTile = new OfferingTile(4);
|
|
|
|
List<Symbol> correct = List.of(Symbol.DOWN,Symbol.UP);
|
|
|
|
assertEquals(correct,offeringTile.getActions());
|
|
|
|
}
|
|
} |